Numbers

3.1  Infinities, NaNs

Infinities and NaNs are artifacts that help deal with the inexactness of binary floating-point arithmetic. The semantics dealing with infinities and NaNs, or the circumstances leading to their generation are somewhat arbitrary. However, as most Scheme implementation use an IEEE-754-conformant implementation [18] of flonums, R6RS uses the particular semantics from this standard as the basis for the treatment of infinities and NaNs in the report. This is also the reason why infinities and NaNs are flonums and thus inexact real number objects, allowing Scheme systems to exploit the closure properties arising from their being part of the standard IEEE-754 floating-point representation. See section 11.6.6 for details on closure properties.

Infinities and NaNs are not considered integers (or even rational) by R6RS. Despite this, the ceiling, floor, round, and truncate procedures (and their fl-prefixed counterparts) return an infinity or NaN when given an infinity or NaN as an argument. This has the advantage of allowing these procedures to take arbitrary real (or flonum) arguments but the disadvantage that they do not always return integer values. The integer values of the mathematical equivalents of these procedures are, in fact, infinite for infinite inputs. Also, while infinities are not considered integers, they might represent infinite integers. So the extension to infinities, at least, makes sense. The extension to NaNs is somewhat more arbitrary.

R6RS intentionally does not require a Scheme implementation to use infinities and NaNs as specified in IEEE 754. Hence, support for them is optional.

3.2  Distinguished -0.0

A distinguished -0.0 is another artifact of IEEE 754, which can be used to construct certain branch cuts. A Scheme implementation is not required to distinguish -0.0. If it does, however, the behavior of the transcendental functions is sensitive to the distinction.