For 32-bit version of Perl, the maximum integer (without using bigint or similar) that can be stored precisely is -253 on the negative side and 253 on the positive side.

>perl -e"printf qq{%.f\n}, 2**53+$_ for +1,0,-1" 9007199254740992 9007199254740992 9007199254740991 >perl -e"printf qq{%.f\n}, -2**53+$_ for +1,0,-1" -9007199254740991 -9007199254740992 -9007199254740992
build settingsMax positive integerMax negative integer
32-bit ints and double floats253 = 9_007_199_254_740_992-253 = -9_007_199_254_740_992
64-bit ints and double floats264-1 = 18_446_744_073_709_551_615-263 = 9_223_372_036_854_775_808
64-bit ints and quadruple floats2113 = 10_384_593_717_069_655_257_060_992_658_440_192-2113 = -10_384_593_717_069_655_257_060_992_658_440_192

Some operators (notably the bit operators) won't work with every number in that range.
Some C extensions won't work with every number in that range.


In reply to Re: maximum value of a scalar by ikegami
in thread maximum value of a scalar by targetsmart

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.