in reply to Re^15: NaN output
in thread NaN output

by my reading of Wikipedia, underflow ... is also an exception in IEEE 754. So it, too, pertains to "a value beyond the capabilities of the binary format to represent".

Maybe we'll see you referring to an "erroneous zero" at some time in the future ;-)

Hm. Did you ever see Edward Woodward in The Wicker Man? That was a bigger straw man, but not by much :)

An "erroneous zero"? No. A value of zero erroneously produced when underflow occurs, yes.

And if you override the run-time's dubious default setting of 'ignoring floating point exceptions', it can even be detected and handled:

#define _CRT_SECURE_NO_WARNINGS 1 #include <stdio.h> #include <float.h> #include <excpt.h> int main( int argc, char **argv ) { unsigned int u = _controlfp(0, 0); double x = 0.5e-323, y = 0.5e-323; printf( "x contains: %g before dividing by 2\n", x ); x /= 2; printf( "x now contains: %g\n", x ); u = u & ~_EM_UNDERFLOW; _controlfp(u, _MCW_EM); printf( "\ny contains: %g before dividing by 2\n", y ); __try { y /= 2; } __except( EXCEPTION_EXECUTE_HANDLER ) { printf( "Floating point underflow exception occurred\n"); } printf( "y now contains: %g\n", y ); return 0; }

So whilst the value zero isn't erroneous; a variable can acquire the value zero erroneously:

C:\test>intOverflow.exe x contains: 4.94066e-324 before dividing by 2 x now contains: 0 y contains: 4.94066e-324 before dividing by 2 Floating point underflow exception occurred y now contains: 4.94066e-324

Is this going anywhere?


With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

Replies are listed 'Best First'.
Re^17: NaN output
by syphilis (Archbishop) on Mar 07, 2014 at 10:55 UTC
    Is this going anywhere?

    Nuh :-)

    I'm out,
    Rob