There seems to be some upper limit of about 300 digits

Actually, the limit is a lot smaller: as perl uses floating points to store its numbers, what you end up with is a big inaccurate number. the exact limits and accuracy are dependand.

If you want to know how perl stores numbers type:

perl -V
To see the flags your perl interpreter was compiled with.

Find the line saying nvtype=' ... ' which is your system representation for perl numbers (usually double I guess). Also uselongdouble and uselongfloat if set to define might make your numbers more accurate.

You will have to decide for yourself if you care about the inaccuracies, if you do, see Math::Bigint and Math::Bigfloat as mentioned in the posts above.

Note: If you have a number stored in a string, it will only get converted when use them as numbers. So things like $big_number = '10231273879128749879857'; stay exact if you do not do arithmetics on them (and don't do things like $big_number == $other_number, use $big_number eq $other_number if you really need to).

-- Joost downtime n. The period during which a system is error-free and immune from user input.

In reply to Re: LARGE numbers in PERL? by Joost
in thread LARGE numbers in PERL? by Anonymous Monk

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.