Re: 0.99999998 (was: Unknown SQL)

From: Bob Badour <bbadour_at_golden.net>
Date: Sat, 21 Jul 2001 23:29:32 GMT
Message-ID: <gmxS6.823$cq5.201657393_at_radon.golden.net>


Sam Staton wrote in message <792lht8oad2s0qntl9b74claoavps3kmea_at_4ax.com>...
>>>Let x := -0. Let y := +0. Assume IEEE arithmetic. The following are
>>>true.

 ...
>>>c) If you test 1/x == 1/y, you get false.
>>
>>Actually, you should get a divide by zero error. Both sides of the
>>comparison are undefined.
>
>Actually, you get false. I choose Java, since it is recent enough to
>guarantee full IEEE support. Try it yourself, or check the IEEE
>standard. In IEEE arithmetic, you only get 'errors' if you explicitly
>install trap handlers or inspect status flags.

And what would you think of a DBMS that doesn't handle errors or inspect status flags? Can you honestly fault me for assuming a sound implementation?

>This is partly because
>in many cases, the value 'Infinity' is not an 'error'.

Some people fool themselves into believing that, I know. However, the fact remains that Infinity lies outside the set of real numbers -- the set that IEEE purports to represent. As such, the rules that apply to real numbers do not apply to Infinity. No numeric representation will ever correctly handle undefined values without additional help.

>System.out.println(1/x == 1/y); // prints 'false'

Which you originally identified as inconsistent and erroneous. I'm not certain what point you are trying to make.

Regards,
Bob Received on Sun Jul 22 2001 - 01:29:32 CEST

Original text of this message