[r6rs-discuss] [Formal] < is inconsistent on NaNs.

John Cowan cowan at ccil.org
Sat Jan 20 12:47:41 EST 2007


Aubrey Jaffer scripsit:

> 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.

The syntax template for = and friends requires at least two arguments,
so the behavior of (< +nan.0) is moot.

> 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.

I agree that it should clearly be specified that the presence of any
NaN among otherwise-correct arguments should force the returned
value to be #f.  IEEE 754 prescribes the behavior only for two-argument
comparisons, but if we understand (< a b c) to mean (and (< a b) (< b c))
and extend in the obvious way, then any NaN will force #f.

-- 
John Cowan   cowan at ccil.org    http://ccil.org/~cowan
Original line from The Warrior's Apprentice by Lois McMaster Bujold:
"Only on Barrayar would pulling a loaded needler start a stampede toward one."
English-to-Russian-to-English mangling thereof: "Only on Barrayar you risk to
lose support instead of finding it when you threat with the charged weapon."



More information about the r6rs-discuss mailing list