Subject Re: Bug: "-0" <> "0" in FB indexes !!!
Author bjorgeitteno
--- In, "Steffen Heil" <lists@s...>
> You are writing 0 and -0, not 0.0 and -0.0, but I assume you really
> floating point numbers.
> So what do floating point numbers mean? They are approximations.
> +0.0 means somewhere near 0.0, maybe a litte more.
> -0.0 means somewhere near 0.0, maybe a litte less.

if you run this:

select (0.0*-1.0)*10e307 val from rdb$database'll get a result of 0. If the "approximation" of (0.0*-1.0)
contained any digits <> 0 at all, it would be present. I believe,
with the binary formats of floats, '0.0' is an exact value. Of course
is with the currently used formats, because a '0.0' is a variable
filled with 0's, and a '-0.0' is the same except for the sign bit set
to 1.

But if one *wanted* two zero types, it should be concistent. One
should not treat the values differently when dealing with indexes and
with normal field value retrieval.

I believe one doesn't want a database engine to distinguish between
positive and negative zero. If one was to deal with complex maths,
one might want to, of course.

A statement like:

select * from tbl where float_field = 0.0

correctly (or *not*, if you want to distinguish, of course) returns
the rows containing "float_field = 0" or "float_field = -0". *If* a
usable index is not present.

> [In fact, 0.0 is here used to explain, it does NOT exist at all.
> point systems only know about +0.0 and -0.0]
> Another point to see, that they are NOT equad:
> +1.0 / +0.0 = +infinity
> +1.0 / -0.0 = -infinity

...which is about the only practical use for this number...

Assuming that the value stored (-0.0) is the correct outcome of the

-1 * 0

..then the behaviour of FB shown in the select statement above is not
correct provided you want the two values to be distinct.

No matter what the conclusion to this is, one thing needs being fixed:
- The values 0.0 and -0.0 should be either be equal or different
- And, If distinction is implemented: The value -0.0 should sort
between 0 and -1, not as today's 'negative infinity'. Client-side
components must also be able to display '-0'.

I'm really curious about the internals of FB - why -0.0 is evaluated
to be the "most negative number"....
Anyone shed a light on this ?