[r6rs-discuss] [Formal] Formal Comment: NaN should be considered a number, not a real

John Cowan cowan at ccil.org
Thu Jun 21 23:37:02 EDT 2007


Arthur Smyles scripsit:

>   NaN describes specific situations in math that are undefined, like
> 0/0. 

That's what is so excellent about the R6RS definition.  0/0 is undefined
because any number times 0 is 0, and so a NaN is a maximally inexact
number: it could be any real number or even +inf or -inf.  The same
story with (- +inf +inf) and its algebraic equivalents, which is the other
main way to generate a NaN.

As long as complex numbers are primarily viewed as rectangular and
potentially of mixed exactness, it's quite plausible to allow NaN as
either componenent.  Mathematically, you could allow NaN to be
a non-real complex number, but pragmatically that turns out to be
undesirable, given the behavior of floating-point hardware.
Doing so requires every floating point operation on real and imaginary
parts to include an extra check.

-- 
John Cowan
        cowan at ccil.org
                I am a member of a civilization. --David Brin



More information about the r6rs-discuss mailing list