As for the "why" of rounding errors associated with the representation of floating point base-ten numbers using a binary subsystem, see perlfaq4, and perlnumber. This is a pretty common question. On any given day there's about a 5% chance some version of this question will show up here, which earns it a slot in the FAQ.

To answer why two versions of Perl produce different versions of the rounding error, that's most likely a difference in the build, either as it pertains to the compiler's nuances, or the architecture targeted by the compiler.

At any rate, floating point numbers really don't make good lookup keys. If absolute precision is required, you're probably better off stringifying and manipulating the stringified representation of numbers by hand, or re-thinking the strategy altogether so as to favor a more reliable lookup method.


Dave


In reply to Re: Decimal precision issue: Windows vs. Unix by davido
in thread Decimal precision issue: Windows vs. Unix by whakka

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.