in reply to Detecting ineger overflow
C ignores integer overflow so Perl does as well.
I suggest you drop the use integer (no "s") and check for "mantissa overflow" with:
then you can do deal with 56-bit integers the way Perl normally deals with 56-bit integers and roll your own when you need more bits than that. I haven't done much analysis on my suggestion so there may be corner cases where this won't work very well. ): - tye (but my friends call me "Tye")sub add { my $result= $_[0] + $_[1]; if( 1+$result == $result ) goto &myadd; return $result; }
|
|---|