[r6rs-discuss] [Formal] NaN is not a real number.

Aubrey Jaffer agj at alum.mit.edu
Wed Sep 20 15:23:55 EDT 2006


	         submitter's name: Aubrey Jaffer
	submitter's email address: agj at alum.mit.edu
		    type of issue: Defect
		         priority: Minor
		   R6RS component: Arithmetic
	    version of the report: 5.91
one-sentence summary of the issue: 

NaN is not a real number.

    full description of the issue:

  Page 10: 2.4. Infinities and NaNs

    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.

+inf.0 and -inf.0 are real numbers because they are part of the total
ordering of that subset of the real numbers represented in Scheme.
NaN is not part of that ordering; thus it is not a real number.  It
is, however, a complex number.

(/ 0.0 0.0) is NaN because any finite number satisfies the equation:

  z * 0.0 = 0.0.

And that includes any finite complex number!  Restricting NaN to be
real is wrong.

In page 10, "2.4. Infinities and NaNs", I propose the sentence should
be changed to read:

    A NaN is regarded as a complex number whose value is so
    indeterminate that it might represent any complex number.

On page 38, the line:

  (real? +nan.0) ==> #t

should be changed to:

  (real? +nan.0) ==> #f

Because it doesn't participate in the ordering, +nan.0 is not an
acceptable argument to numerical-ordering predicates (<, <=, >, >=,
negative?, positive?, etc).

On page 100, the lines

  (fl= +nan.0 fl) ==> #f
  (fl< +nan.0 fl) ==> #f

should be removed.




More information about the r6rs-discuss mailing list