I have noticed that the largest integer I can safely work with is 9007199254740991 in 32-bit environment. And that's because the numbers are stored in IEEE-754 format internally. Whatever that means. Anyway, my question is if Perl is compiled for a 64-bit machine and supports 64-bit integer operations, does it still store numbers same way internally, or is there something totally different in place for that? Because I would like to know what's the largest integer I can safely work with in a 64-bit environment.
Here is a simple example:
my $MAXQUAD = 18446744073709551615; # equals 0xffffffffffffffff
for (my $i = 0; $i <= $MAXQUAD; $i++)
{
printf("\n %f", $i);
}
exit;
Please ignore the fact that this will take forever to count from 0 to $MAXQUAD, but would it actually work? ...because in a 32-bit environment, this loop will never end! It will count from 0 to 9007199254740992, and it will not increment beyond that. It will just get stuck at that number.
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.