Ok - I mean the min/max integer value for a scalar $i at the point where $i-- or $i++ will overflow and fail to return the expected value.
Ah, that's yet another question. First of all, Perl numbers
don't "overflow" in the sense that adding 1 to a really big
positive number gives you are really small negative number.
Say you have:
$i = 0; $i ++ while forever;
What happens is:
- $i starts life as a value where its value is represented
as an integer.
- At one moment, the integer has insufficient bits to
represent $i. Then perl starts using a floating point number, typically a double.
- Due to rounding it won't happen if you keep adding 1,
but if you keep increasing $i, even the floating point
number will run out of bits; then $i becomes "not a number".
If your double has more bits than your integer (a very typical situation, specially in older perls, is having
32 bit integers and 64 bit doubles), there's an interesting
situation after the change of representation. 64 bit doubles
still have something like 53 bits of precision. So, even
with 32 integers, you can still store numbers needing 53
bits without losing precision. And I guess something similar
will happen if you have 64 bit integers, and 128 bit doubles.
Abigail
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.