About Float negativeZero

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

About Float negativeZero

Nicolas Cellier-3
Meaning of Float negativeZero is to represent a negative number so small
that we cannot represent it with smallest available Float...
That occurs after an underflow.
Like for example
        -1.0e-300 * 1.0e-100

We know it is negative, but in the same time, we cannot distinguish it
from zero...
IEEE 754 decided that
        (Float negativeZero = 0.0) = true

Rationale: there is no positiveZero, so there is no reason why
        (-1.0e-300 * 1.0e-100 = 0.0) = false
while
        (1.0e-300 * 1.0e-100 = 0.0) = true

A consequence of this in Squeak is:
        Float negativeZero negative = false
As the name does not tell...

Tricky Float...
I will try to play with this logic:

One feature in IEEE is division by a negativeZero:
        (1.0 / Float negativeZero)
is expected to produce a negative infinity.

So I expect a breach of logic with:
        (1.0 / Float negativeZero) negative = true
Not in Squeak, we are saved by a ZeroDivide...

Sure I can make it with FloatArray:
        (1.0 / (FloatArray with: Float negativeZero)) first negative = true

But there
- I find a bug (http://bugs.squeak.org/view.php?id=6782)
- after correcting, still have a ZeroDivide.

Do I lack the plugin?