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

Re: transitivity requirement on scheme comparison and rational?

"It is possible to implement the Scheme number system using IEEE
floating point numbers with (either symmetric or asymmetric) error
bounds, and that would be a very useful thing to do.  With symmetric
error bounds, the difference between this and conventional interval
arithmetic is a bit subtle.  One difference is that Scheme's comparison
predicates would use the locally best approximation, ignoring the error
bounds.  Another difference is that the midpoint of an interval is
seldom the same as the locally best approximation, and the midpoint
might not be an IEEE floating point number anyway.  In short, an IEEE
floating point number with error bounds is more expensive to compute
than an interval, but it also gives more information, especially with
asymmetric error bounds."

Granted, this is possible.  But it gives rise to another set of anomalies.  For

(real? (if (= x 4.0) (sqrt x) 2))

may evaluate to #f or generate an error if the interval for x includes negative
values but the locally best approximation is 4.0.  My impression is that if you
don't interpret = as "overlaps", < as "definitely <", etc., then most code
written without knowledge of interval arithmetic will break.

What were the nasty examples that break if inexact comparisons are not forced
to be transitive?