[Ecls-list] wrong value for (float-sign -0.0)

Raymond Toy toy.raymond at gmail.com
Sun Sep 28 19:13:55 UTC 2008


Gabriel Dos Reis wrote:
> Raymond Toy <toy.raymond at gmail.com> writes:
>
> | Gabriel Dos Reis wrote:
> | > Hi Juanjo,
> | >
> | >   ECL reports wrong value for the sign of -0.0.
> | >
> | >   > *features*
> | >   (:LINUX :FORMATTER :IEEE-FLOATING-POINT :RELATIVE-PACKAGE-NAMES :DFFI
> | >    :CLOS-STREAMS :CMU-FORMAT :UNIX :ECL-PDE :DLOPEN :CLOS :BOEHM-GC :ANSI-CL
> | >    :COMMON-LISP :ECL :COMMON :PENTIUM3 :FFI :PREFIXED-API)
> | >   > (float-sign -0.0)
> | >   0.0
> | >
> | >
> | > The correct value is -1.0.
> | >
> | >   
> | Signed zeroes aren't required to be supported.
>
> Notice :IEEE-FLOATING-POINT on the *features*.
What does that mean?  I don't think it's specified anywhere what that
really means, especially pertaining to signed zeroes.  I vaguely
remember the CLHS saying signed zeroes aren't required.
>   
>
> ECL is using the machine native `double'; there is no point in
> pretending it does not have signed 0.0.
>
> |  It looks like ecl
> | doesn't support signed zeroes.  (eql -0.0 0.0) -> T.
>
> That equality has to hold no matter whether signed zeros are supported
> or not.  
>   

No, that's incorrect.  -0.0 and 0.0 have completely different
representations and eql makes it clear.  If signed zeroes are supported
then eql must return NIL:

CMUCL:  (eql -0.0 0.0) -> NIL.

>
>
> So far, SBCL which is the other Lisp using native `double' is the only
> free Lisp which gets it right (my version of CLisp does not pretend to
> have :IEEE-FLOATING-POINT on its *features*).
>
>   
CMUCL has had signed zeroes for over a decade, I think.

There are quite a few people who think signed zeroes without an unsigned
zero is bad.  (I actually like signed zeroes since it makes branch cuts
easier.)

Since ecl compiles to C, it might be difficult to get signed zeroes to
work out right.

Ray






More information about the ecl-devel mailing list