in reply to Re: How to portably determine integer limits?
in thread How to portably determine integer limits?
This meaningfulness does give a clue on how to efficiently test how large the range can be: I'm quite convinced the limit is always closely related to a power of 2 so one could shift a number to the left, until the result differs from the number times 2, in floating point calculation.
I get:my $i = 0; my $n = my $m = 1; while($n == $m) { $n <<= 1; $m *= 2; $i++; } print "different for $m (2**$i)\n";
different for 4294967296 (2**32)What precisely this implies, I leave as an exercise for the reader. :)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: How to portably determine integer limits?
by exussum0 (Vicar) on Oct 30, 2003 at 05:26 UTC |