At 12:58 -0700 8/4/07, chromatic wrote:
>On Wednesday 01 August 2007 13:50:45 Joshua Hoblitt wrote:
> > #include <stdio.h>
>> #include <math.h>
>>
>> int main ()
>> {
>> printf("0.0 : %f\n", 0.0);
>> printf("-0.0 : %f\n", -0.0);
>> printf("0.0 == -0.0 : %d\n", 0.0 == -0.0);
> > }
I'm afraid that would me more of a compiler test than a test of the floating
point processing unit. Those decimal to binary conversions at compile time or
even at getc or scan time are likely to dominate the result by refusing to
store a floating -0.
A union of a stored float with a 64 bit integer would allow storing a bit
pattern with a negative sign bit and all zeros otherwise. Ask for a floating
point comparison of that with a "real" floating 0.0. And perhaps one should try
it again with an 80 bit extended float.
--
--> If you are presented a number as a percentage, and you do not clearly
understand the numerator and the denominator involved, you are surely being
lied to. <--