Formal comment #145 (defect)
< is inconsistent on NaNs.
Reported by: Aubrey Jaffer
Version: 5.92
Page 42: 9.9.4 Numeric Operations gives < as a procedure of one or
more real arguments:
(< x1 x2 x3 . . . ) procedure
But later in the description states:
For any number z:
(= +nan.0 z) ==> #f
(< +nan.0 z) ==> #f
This implies that, while (< 0 1+i) should signal an exception, (<
+nan.0 1+1i) should return #f. If 1+i is an illegal argument to <
sometimes, then it should always be an illegal argument to <.
The behavior of (< +nan.0) [and (= +nan.0)] should be specified. Is
the sequence of just +nan.0 "monotonically increasing"? If so, then (<
+nan.0) should return #t. This would seem to be inconsistent with
+nan.0 forcing the example (< +nan.0 z) to return #f.
Having only one NaN inequality example [<] leaves the behavior of >,
<=, and >= on NaNs? open to question, as well as the behavior when NaN
is other than the first argument.
RESPONSE:
The second example contains an error; (< +nan.0 x) is false
for any real x, and (< +nan.0 1+1i) must (according to
R5.92RS) raise an exception. The error will be corrected
in the next draft of the report.
Examples of < and = with a NaN as second argument might
be desirable, as may additional examples for >, <=, and
>=, but this is an editorial decision. The intent of the
NaN examples is to illustrate that all comparisons involving
a NaN return false.
Numerical comparisons, including < and =, require two
or more arguments. The formal comment does not explain
why they should be extended to accept a single argument,
so we assume the comment's consideration of such cases
arose from a misreading of the draft report.