[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

*To*: RRRS-Authors@mc.lcs.mit.edu*Subject*: transitivity requirement on scheme comparison and rational?*From*: Hans_Boehm.PARC@xerox.com*Date*: Mon, 17 Feb 1992 13:59:51 PST*Cc*: Hans_Boehm.PARC@xerox.com*Posted-Date*: Mon, 17 Feb 92 13:50:53 PST*Reply-To*: Hans_Boehm.PARC@xerox.com

I may be missing something. But the requirement in R4RS that numerical comparisons are transitive seems strange to me. Consider comparing a rational x and a floating point number y for equality. Let the exact rational representation of y be z. I can call x and y equal at most when z is exactly x. (Otherwise I have z = y, and x = y, but not x = z.) But this means that unless I have an "inexact rational" number representation (a serious loss in my opinion), the following can generate a divide by zero error: (if (= x y) (...) (/ (- x y))) Matters get considerably worse if I decide to use interval arithmetic instead of simple floating point. It seems to me that the natural interpretation of = over interval arithmetic is "may be equals" or "overlaps". This isn't transitive (which is the root of the above problem). Thus my only real option is to define no two intervals (with nonzero size) as equal. (Of course, the user will then immediately define x = y to mean not (x < y or x > y) which is meaningful, but not transitive.) On a slightly different subject, I interpret the scheme standard to mean that in current implementations (rational? (sqrt 2)) will evaluate to #t. Is there a reason for including rational? in the standard It seems to provide useful information only if I include an algebraic number package or something similar. This is probably not practical, and furthermore standard scheme doesn't give me the primitives to compute an arbitrary algebraic number, I believe. So I would need to add primitives in any case. Hans

- Prev by Date:
**The time has come, the Walrus said, To talk of many things...** - Next by Date:
**Re: (rational? (sqrt 2))** - Prev by thread:
**The time has come, the Walrus said, To talk of many things...** - Next by thread:
**Re: transitivity requirement on scheme comparison and rational?** - Index(es):