Because allowing use of NV values re-introduces the very rounding anomalies we're (normally) trying to avoid:
C:\>perl -MMath::Decimal64=":all" -le "$x=Math::Decimal64->new('0.085' +); $y = Math::Decimal64->new(0.085);$z = NVtoD64(0.085);print $x;prin +t $y; print $z;" Outputs: 85e-3 8500000000000001e-17 8500000000000001e-17
$y and $z are assigned from the actual NV value, whereas $x is assigned the specified decimal value.

The trouble with allowing overloading of NVs is that it makes it just too easy for people to inadvertently use a value that they didn't really mean to use - though I guess the same criticism could be levelled at new() because *it* currently allows assignment of NVs.
NVtoD64() ought to be there so that one *can* assign the NV to a Math::Decimal64 object if one wants. It's name pretty much explicitly indicates what it's going to do, thus making it less likely that one will inadvertently assign an unintended value.

Cheers,
Rob

In reply to Re^4: floating point addition by syphilis
in thread floating point addition by kresike

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.