请输入您要查询的百科知识:

 

词条 Numerical tower
释义

  1. References

In Scheme and Lisp dialects inspired by it, a numerical tower is the set of data types that represent numbers in a given programming language.

Each type in the tower conceptually "sits on" a more fundamental type, so an integer is a rational number and a number, but the converse is not necessarily true, i.e. not every number is an integer; this asymmetry implies that a language can allow implicit coercions of numerical types—without creating semantic problems—in only one direction: coercing an integer to a rational loses no information and does not affect the results of a function, but to coerce most reals to an integer could well result in a problem (for example, the real 1/3 does not equal any integer).

The Scheme programming language defines all its arithmetic within this model, as do most other Lisp dialects.[1] Some implementations may extend or adapt the tower. Kawa, a Scheme implementation for JVM, extends it with a Quantity type that is even more generic than Number. Smalltalk is another programming language that follows this model, but it has a Magnitude as superclass of Number. Another popular variant is having both exact and inexact versions of the tower or parts of it; R7RS Scheme recommends but does not strictly require this of implementations. Most programming languages and language implementations do not support a Scheme-like numerical tower, though some languages provide limited or inconsistent support if implementation simplicity permits.

References

1. ^http://www.schemers.org/Documents/Standards/R5RS/HTML/r5rs-Z-H-9.html#%_sec_6.2.1
{{DEFAULTSORT:Numerical Tower}}{{compu-prog-stub}}

1 : Data types

随便看

 

开放百科全书收录14589846条英语、德语、日语等多语种百科知识,基本涵盖了大多数领域的百科知识,是一部内容自由、开放的电子版国际百科全书。

 

Copyright © 2023 OENC.NET All Rights Reserved
京ICP备2021023879号 更新时间:2024/11/17 20:05:00