guile-user
[Top][All Lists]
Advanced

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

Reverting eqv? behavior for signed zeros and nans to 1.6 semantics


From: Marius Vollmer
Subject: Reverting eqv? behavior for signed zeros and nans to 1.6 semantics
Date: Sun, 16 Jul 2006 21:04:20 +0300
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

Hi,

after enormous procrastination, I am now convinced that the change in
semantics of eqv? from 1.6 to 1.8 was wrong, and I think that we
should revert the eqv? behavior for the next 1.8.1 release.  It's a
bug in the design and should be fixed.

(Credit goes to Aubrey Jaffer for pointing out the bug in the first
place, and Kevin for making me understand.)

R5RS is pretty clear about the relation between '=' and 'eqv?' and we
should follow that (even tho one could argue that R5RS has not been
written with signed zeros and NaNs in mind and R6RS will likely be
different in this area).

Specifically, 'eqv?' would be changed to return '#t' when comparing
negative and positive zero:

    (eqv? 0.0 -0.0) => #t

and should return #f for nans:

    (eqv? +nan.0 +nan.0) => #f

If you need to test the sign of zero by turning it into the
corresponding infinity

   (> (/ 0.0) 0) => #t
   (> (/ -0.0) 0) => #f

To test for a NaN, use 'nan?'.

Ok?

-- 
GPG: D5D4E405 - 2F9B BCCC 8527 692A 04E3  331E FAF8 226A D5D4 E405




reply via email to

[Prev in Thread] Current Thread [Next in Thread]