(zerop (- x y))
is not the same as
(eql x y)
when x=0.0 and y=-0.0.
"If an implementation supports positive and negative zeros as distinct values ..., then (eql 0.0 -0.0) will be false." CLtL Manual.
You've been warned: "_Everything_ about -0.0 needs to be special-cased" !
(Special-casing -0.0 is antithetical to everything about mathematics, where we try to make things as uniform as possible, precisely to avoid special-casing.)
At 02:00 PM 12/3/2012, Richard Fateman wrote:
>On 12/3/2012 1:27 PM, Henry Baker wrote:
>>My email was sent more as a warning: "abandon hope, all ye who enter here", because normal algebraic facts about 0.0=-0.0 no longer hold true.
>>
>>Everything about -0.0 needs to be special-cased.
>>
>>If you admit -0.0, then plan on grepping the entire Maxima corpus & finding all tests for zero; then find all places in Maxima where you now have to _add_ tests for -0.0.
>
>I think the way to do this is to use (zerop x) which is true for 0, 0.0, -0.0.
>For maxima we should extend this for bigfloats, rational expressions, .....