my $x;
$x *= 2;

Use of uninitialized value $x in multiplication (*) at ...


Good analogy. With the mpfr library (as with perl), such an operation does not cause a fatality - but a warning *is* provided (if the program explicitly looks for it) in that the nan flag is set:
#!perl -swl use Math::MPFR qw(:mpfr); my $fr = Math::MPFR->new(); print $fr; warn "nan flag not set\n" unless Rmpfr_nanflag_p(); $fr *= 2; warn "nan flag set\n" if Rmpfr_nanflag_p(); print $fr; Rmpfr_clear_nanflag(); # Clear nan flag __END__ Outputs: @NaN@ nan flag not set nan flag set @NaN@
Maybe the Math::MPFR/Math::MPC overloading of the arithmetic operators should warn about operations involving NaN's by default (at least if warnings are enabled) ... that would be quite a perlish thing to do!

Cheers,
Rob

In reply to Re^4: NaNs are true by syphilis
in thread NaNs are true by syphilis

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.