3 ms·
How the language handles it is that neither 0.0 nor -0.0 satisfy either the minusp or plusp function, and the numbers are equal under eql or weaker. I think th
by kazinator 6y ago
How the language handles it is that neither 0.0 nor -0.0 satisfy either the minusp or plusp function, and the numbers are equal under eql or weaker.
I think the only way to write a comparison function f such that (f -0.0 0.0) yields nil would be to print the numbers into character strings and compare those. But even that wouldn't be portable to CLISP.
- ksaj 6y agoA rising zero / falling zero is the difference between freezing and melting, where you can see zero as a fuzzy number that is too low to consider close to 1, and too high to consider close to -1, while distinctly approaching one or the other. Here's a LispWorks session: CL-USER 1 > (minusp -0.0f0) ; as you said NIL CL-USER 2 > (< -0.f0 0.0f0) ; as minusp & you predict NIL CL-USER 3 > (* -0.f0 0.f0) ; but... -0.0 CL-USER 4 > It seems inconsistent that the multiply function understands that zero is approaching -1, but less-than doesn't.