can I rely on this behaviour of simplifying the number?)

Perl's print() function does indeed like to "simplify" numbers, often to an embarrassingly absurd extent.
Here, we see three unequal numbers printed identically:
C:\>perl -e "$x = 1.23456789012345e15; print $x;" 1.23456789012345e+15 C:\>perl -e "$x = 1.234567890123454e15; print $x;" 1.23456789012345e+15 C:\>perl -e "$x = 1.2345678901234544e15; print $x;" 1.23456789012345e+15
Perl knows that all 3 values are different:
C:\>perl -e "print 'different' if 1.23456789012345e15 != 1.23456789012 +3454e15;" different C:\>perl -e "print 'different' if 1.23456789012345e15 != 1.23456789012 +34544e15;" different C:\>perl -e "print 'different' if 1.234567890123454e15 != 1.2345678901 +234544e15;" different
yet happily presents them as identical.
You can't really rely on perl's print() for anything much when floating point values are concerned.

Cheers,
Rob

In reply to Re: Perl 5 numeric type and simplifications by syphilis
in thread Perl 5 numeric type and simplifications by pango

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.