[Ecls-list] wrong value for (float-sign -0.0)
Juan Jose Garcia-Ripoll
juanjose.garciaripoll at googlemail.com
Sun Sep 28 20:29:22 UTC 2008
On Sun, Sep 28, 2008 at 9:13 PM, Raymond Toy <toy.raymond at gmail.com> wrote:
>> | Gabriel Dos Reis wrote:
>> | > Hi Juanjo,
>> | >
>> | > ECL reports wrong value for the sign of -0.0.
>
> Since ecl compiles to C, it might be difficult to get signed zeroes to
> work out right.
Seems to be the case. If you look at the implementation of float-sign,
we get the sign just by comparing against 0
case t_singlefloat:
negativep = sf(x) < 0; break;
case t_doublefloat:
negativep = df(x) < 0; break;
This does not seem to be the right way to get the sign :-/ I have
changed the code now to use the macro signbit() where available. I
also had to change the reader and other numeric functions to allow
creating signed zeros. Now things are better: -0.0 and 0.0 can be read
and printed, they do not compare EQL but are the same under numeric
comparison with #'=
Juanjo
--
Instituto de Física Fundamental, CSIC
c/ Serrano, 113b, Madrid 28009 (Spain)
http://juanjose.garciaripoll.googlepages.com
More information about the ecl-devel
mailing list