| From: Thomas Bushnell BSG <xxxxxx@becket.net>
| Date: Sat, 22 Oct 2005 17:51:06 -0700
|
| Aubrey Jaffer <xxxxxx@alum.mit.edu> writes:
|
| > | From: "Marcin 'Qrczak' Kowalczyk" <xxxxxx@knm.org.pl>
| > | Date: Sat, 22 Oct 2005 20:52:50 +0200
| > |
| > | Aubrey Jaffer <xxxxxx@alum.mit.edu> writes:
| > |
| > | > The total order of the reals is a crucial property for many
| > | > applications. Any subset of the reals has a total order.
| > | > The reals with +inf.0 and -inf.0 have a total order.
| > | >
| > | > But the reals with +inf.0, -inf.0, and +nan.0 do not have a total
| > | > order [because (<= 5 +nan.0) and (>= 5 +nan.0) would both be false].
| > |
| > | It is well known that the default order on the floating point
| > | approximation of reals is not total.
The floating-point approximations to the reals do not include NaN.
(which real number would it be approximating?)
| > From Wikipedia, the free encyclopedia.
| > <http://en.wikipedia.org/wiki/Total_order>
| >
| > In mathematics, a total order, linear order or simple order on a set
| > X is any binary relation on X that is antisymmetric, transitive, and
| > total. This means that, if we denote the relation by <=, the
| > following statements hold for all a, b and c in X:
| >
| > if a <= b and b <= a then a = b (antisymmetry)
| > if a <= b and b <= c then a <= c (transitivity)
| > a <= b or b <= a (totalness)
| >
| > Which condition does it violate?
|
| Totalness (as Marcin said). NaN comparisons (other than
| not-equals) always evaluate false.
My point exactly! NaN violates totalness. Thus it is not a real
number.
Having (real? +nan.0) ==> #f and +nan.0 be an illegal argument to >,
<, <=, and >= is compatible with IEEE-754. Just because IEEE-754
defines a behavior for comparisons with NaN doesn't mean Scheme must
redefine <, ... so that it accepts non-real arguments. Scheme already
has lots of non-real numbers which are illegal arguments to >:
(> 5 5.+3.i)