-0.0 in Common Lisp



On 12/3/2012 10:10 AM, Henry Baker wrote:
> In 1993, I said
>
> "Either IEEE = is not an identity predicate or IEEE atan is not a function, because 0.0=-0.0, but atan(0.0,-0.0)!=atan(-0.0,-0.0); due to this and other reasons, IEEE -0.0 is an algebraic abomination."
>
> More succinctly, -0.0 violates the concept of "referential transparency"; i.e., the ability to substitute equals for equals.
I think the argument here is that "="  represents numerical equality. 
For example,
(= 2 2.0) returns t.

and thus
(= 0.0 -0.0)  could be true even though there are ways of distinguishing 
them.

note that  (floatp 2) and (floatp 2.0)  differ.

CL has a pile of equality predicates: eql eq equal  as well as =.
RJF


>
> http://www.pipeline.com/~hbaker1/ObjectIdentity.html
>
> At 09:30 AM 12/3/2012, Raymond Toy wrote:
>> CL doesn't forbid signed zeroes.  Any CL that uses the IEEE754
>> hardware will get signed zeroes whether you want it or not.  In fact,
>> for lisps that "don't" support signed zeroes, I think the only real
>> issue is that the lisp printer and reader doesn't support signed
>> zeroes.  If that's changed, you get signed zeroes automatically,
>> because the hardware has it.
>
> _______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima