Usually, NaN shows up because of errors such as 0/0, so disabling it seems rather pointless (and philosophically related to the discussion here).

It would be nice if you told us why you're worried about NaN. In my experience NaN usually means somebody (usually the programmer) forgot to initialize a variable or forget to test for something akin to 0/0 or atan2(0,0). In other words, NaN is indicative of a problem that should be dealt with in application code, not papered over by turning off floating point exception handling.

Now, if you really, really, really need to disable NaN, I'd suggest writing a module to overload the arithmetic operators, as was done to handle arbitrarily long floats in Math::BigFloat, which you'll have to build with appropriate compiler options so that you, the programmer, can trap and deal with NaN.

Don't munge up Perl; write a custom arithmetic module which does NaN-less arithmetic.

emc

At that time [1909] the chief engineer was almost always the chief test pilot as well. That had the fortunate result of eliminating poor engineering early in aviation.

—Igor Sikorsky, reported in AOPA Pilot magazine February 2003.

In reply to Re: Q: NaN again by swampyankee
in thread Q: NaN again by Anonymous Monk

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.