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

Gabriel Dos Reis gdr at cs.tamu.edu
Sun Sep 28 14:42:54 UTC 2008


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*.  

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.  In fact, in IEEE 754 semantics, you cannot distinguish signed
0.0 by just using relational or equality operators.  You use the
operator that gives the sign bit.

Signed zeros are important for the semantics numerics based on IEEE
754 semantics.   The way I disovered was precisely because I was
debugging a failing OpenAxiom program based using ECL as its Lisp.
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*).

-- Gaby




More information about the ecl-devel mailing list