[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
floating point question
I am wondering about the following bizarre character of
the Common Lisp treatment of floats and ratios when doing
comparisons, specifically = ..
Suppose that you have X and Y where x is a SINGLE-FLOAT and
Y is a RATIO. Also suppose that X is 0.0. Mathematically speaking
no ratio is 0. So, according to rules of floating point contagion,
you are supposed to convert Y to be a SINGLE-FLOAT which may result
in a SINGLE-FLOAT == 0.0 due to rounding all of which results in
notions like floating point 0.0 equals a non-zero ratio
due to conversion. If I take another approach for = and test
that the float is indeed 0.0 and thus conclude that no ratio
(by rules of ratio canonicalization) is 0, then I end up with
anomalies like (= X Y) != (= X (FLOAT Y X)) which does seem
strange, but from a mathematical point of view, (= X Y)
in this case should be FALSE. What do you think?
Please pardon me if this question has been asked and/or resolved
in some previous mail.