in reply to maximum value of a scalar
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 settings | Max positive integer | Max negative integer |
|---|---|---|
| 32-bit ints and double floats | 253 = 9_007_199_254_740_992 | -253 = -9_007_199_254_740_992 | 64-bit ints and double floats | 264-1 = 18_446_744_073_709_551_615 | -263 = 9_223_372_036_854_775_808 |
| 64-bit ints and quadruple floats | 2113 = 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.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: maximum value of a scalar
by Anonymous Monk on Mar 01, 2009 at 06:11 UTC | |
by syphilis (Archbishop) on Mar 01, 2009 at 09:38 UTC | |
by Anonymous Monk on Mar 02, 2009 at 05:57 UTC | |
by syphilis (Archbishop) on Mar 02, 2009 at 17:48 UTC | |
by ikegami (Patriarch) on Mar 01, 2009 at 06:43 UTC |