[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
sanity check: <=, >=
Date: 06 Jul 88 11:29:02 PDT (Wed)
From: willc@tekchips.crl
R3RS says that (<= x y) is #t if x and y are "monotonically nondecreasing"
and that (>= x y) is #t if x and y are "monotonically nonincreasing". I
interpret this to mean that (<= x y) is equivalent to (not (> x y)), and
that the following transcript shows correct behavior with respect to the
unordered case in IEEE standard floating point arithmetic. Comments?
>>> (define x (expt 10.0 500.0))
x
>>> x
#<INFINITY>
>>> (define y (- x x))
y
>>> y
#<NOT A NUMBER>
>>> (< 3 y)
#f
>>> (= 3 y)
#f
>>> (> 3 y)
#f
>>> (<= 3 y)
#t
>>> (>= 3 y)
#t
I think (<= y 3) and (>= y 3) being #f is more appealing.
(1) This is consistent with the recommended treatment of .GE. and .LE.
by IEEE standard 754.
(2) "monotonically nondecreasing" does not mean the same thing as
"not monotonically decreasing". At least, I didn't think they meant
the same thing when I put the former in CLtL.
--Guy