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.

In reply to Re^16: NaN output by BrowserUk
in thread NaN output by spikeinc

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.