Next: scheme numbers inf nan, Previous: scheme numbers fix flo, Up: scheme numbers [Index]
Implementations of Scheme must support number objects for the entire tower of subtypes given in Numerical tower. Moreover, implementations must support exact integer objects and exact rational number objects of practically unlimited size and precision, and to implement certain procedures (listed in Propagation of exactness and inexactness), so they always return exact results when given exact arguments. (“Practically unlimited” means that the size and precision of these numbers should only be limited by the size of the available memory.)
Implementations may support only a limited range of inexact number objects of any type, subject to the requirements of this section. For example, an implementation may limit the range of the inexact real number objects (and therefore the range of inexact integer and rational number objects) to the dynamic range of the flonum format. Furthermore the gaps between the inexact integer objects and rationals are likely to be very large in such an implementation as the limits of this range are approached.
An implementation may use floating point and other approximate representation strategies for inexact numbers. This report recommends, but does not require, that the IEEE floating–point standards be followed by implementations that use floating–point representations, and that implementations using other representations should match or exceed the precision achievable using these floating–point standards.
In particular, implementations that use floating–point representations
must follow these rules: A floating–point result must be represented
with at least as much precision as is used to express any of the inexact
arguments to that operation. Potentially inexact operations such as
sqrt
, when applied to exact arguments, should produce exact
answers whenever possible (for example the square root of an exact 4
ought to be an exact 2). However, this is not required. If, on the
other hand, an exact number object is operated upon so as to produce an
inexact result (as by sqrt
), and if the result is represented in
floating point, then the most precise floating–point format available
must be used; but if the result is represented in some other way then
the representation must have at least as much precision as the most
precise floating–point format available.
It is the programmer’s responsibility to avoid using inexact number objects with magnitude or significand too large to be represented in the implementation.
Next: scheme numbers inf nan, Previous: scheme numbers fix flo, Up: scheme numbers [Index]