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

Gabriel Dos Reis gdr at integrable-solutions.net
Sun Sep 28 20:42:12 UTC 2008


On Sun, Sep 28, 2008 at 3:29 PM, Juan Jose Garcia-Ripoll
<juanjose.garciaripoll at googlemail.com> wrote:
> 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 #'=

OK, thanks for this compromise.  Is #'= well optimized when the type of
the operands are known?  (OpenAxiom can automatically generate
proclamations for functions, so I'm wondering if this is a case where it would
help or whether it would not matter).

Is there a chance to document :ieee-floating-point?

Thanks!

-- Gaby
:




More information about the ecl-devel mailing list