Subject Re: [firebird-support] Re: Bug: "-0" <> "0" in FB indexes !!!
Author Geoff Worboys
>> /* INSERT INTO FLOAT_ZERO_TEST (PK, DV) VALUES (-0.0, -0.0);
>> causes duplicate exception */

> This *should* word. IEEE floats distiguish between -0 and +0.
> I DO consider this a BUG.

I did not know what to think of this, which is why I left it
in there as a comment.

I've never seen the actual IEEE standard - and whether it says
anything about how literals should be interpreted or how +/- 0
should be compared. However a quick test using MS VC7.1 with
the following code:
double x = 0.0;
double y = -0.0;
if (x == y) printf("x == y\n");
else printf("x != y\n");
x = -x;
y = -y;
if (x == y) printf("x == y\n");
else printf("x != y\n");
y = -y;
if (x == y) printf("x == y\n");
else printf("x != y\n");

reports "x == y" in all three instances.

I am not saying this is an absolute confirmation (I dont have
that much faith in MS), but I am willing to bet (or at least
hope) that they know more about the standard than I do.

>> The "order by DV" works as expected. "order by PK", the
>> indexed column definitely lists 0 first. This is wrong
>> however you interpret -0 vs +0.

> Okay. This is also a BUG.

Yep.

--
Geoff Worboys
Telesis Computing