Formal comment #230 (defect) NaNs are not real numbers Reported by: Aubrey Jaffer Component: arithmetic Version: 5.92 1. Numbers This chapter describes Scheme's representations for numbers. It is important to distinguish between the mathematical numbers, the Scheme numbers that attempt to model them, the machine representations used to implement the Scheme numbers, and notations used to write numbers. This report uses the types number, complex, real, rational, and integer to refer to both mathematical numbers and Scheme numbers. So the term "real" must conform to mathematical usage. 2.4. Infinities and NaNs? Positive infinity is regarded as a real (but not rational) number, whose value is indeterminate but greater than all rational numbers. Negative infinity is regarded as a real (but not rational) number, whose value is indeterminate but less than all rational numbers. These "regards" can be made less vague: Positive infinity denotes an irrational real number whose value is greater than all rational numbers representable by the implementation. The number (expt 2 (expt 10 10000000000.1)) would be a candidate value for all existing Scheme implementations. A NaN is regarded as a real (but not rational) number whose value is so indeterminate that it might represent any real number, including positive or negative infinity, and might even be greater than positive infinity or less than negative infinity. Here R6RS runs afoul of mathemtatics. A probability distribution is not a real number. While there are an infinitude of numbers which can serve to denote positive infinity, there is no real number whose ordering behavior matches R6RS_92 NaN's behavior in comparisons. Mathematically, a real number must be negative, zero, or positive; thus NaN is not a real number; thus the text of section 2 is incompatible with the report referring to NaN as a real number. Then what about IEEE-754 flonum NaN? 2.1. Numerical types ... Likewise, every implementation is required to designate a subset of its inexact reals as flonums, and to convert certain external representations into flonums. By rewording this sentence, some flonums may be used to designate NaNs?, even though NaNs? are not real: Likewise, every implementation is required to designate a subset of the union of inexact NaNs? with inexact reals as flonums, and to convert certain external representations into flonums. The "fl" comparison operations, which operate on flonums, are then free to follow IEEE-754 NaN comparison behavior. But the "Arithmetic Operations" <, <=, >, and >= on page 42 must signal an exception when applied to non-real arguments like 5+4i or +nan.0. By the way, the behavior of "flmin" and "flmax" are not specified when applied to NaNs?. RESPONSE: This is related to formal comments #143 and #167. The comment's argument is based upon a close reading of the draft R6RS. The editors believe it is important to distinguish between the mathematical numbers and the Scheme numbers that attempt to model them. The editors note the presence and importance of the word "attempt". If NaNs were not regarded as a real number, then the domains and ranges of the flonum procedures would not be a subset of the Scheme numbers that are regarded as real, which would make the flonum operations less compatible with the generic operations. The proposal would also have an adverse effect upon performance, as noted in the response to formal comment #143. The word "indeterminate" does not imply a probability distribution. In fact, it correctly connotes that there is not enough information to construct a probability distribution. The editors believe it is better to continue to regard quiet NaNs as real numbers, and to leave the semantics of signalling NaNs to some future version of the report. The next draft should note that the flmin and flmax procedures always return an inexact NaN when one or more of the arguments is a NaN.