in reply to Integer overflow in Perl and C

1) REXX also treats numbers as numbers, not differenciating between integer and FP.

2) Once your integer grow beyond 53-bits, you will start to loose precision in the conversion to FP.

print $_, ': ', 2**$_ == 2**$_ -1 for 33 .. 64; 33 : 34 : 35 : 36 : 37 : 38 : 39 : 40 : 41 : 42 : 43 : 44 : 45 : 46 : 47 : 48 : 49 : 50 : 51 : 52 : 53 : 54 : 1 55 : 1 56 : 1 57 : 1 58 : 1 59 : 1 60 : 1 61 : 1 62 : 1 63 : 1 64 : 1

On a 64-bit OS, this would not be the case as there would be no need to premote the number to a floating point. Equally, any OS/CRT/FPP that used 80-bit IEEE floating point instead of 64-bit would get a different set of results again--hence non-portable.

3) Depends...


Examine what is said, not who speaks.
"Efficiency is intelligent laziness." -David Dunham
"Think for yourself!" - Abigail
Timing (and a little luck) are everything!