Message48899
Logged In: YES
user_id=31435
This looks pretty good to me -- talk about every trick in the
book <wink>.
Note that the digitlimit vector is too cautious for bases that
are powers of 2. For example, it's obvious that any string of
32 bits can't overflow an unsigned long, but the table cuts
base 2 off at 31 instead. The formula should use log(2**32,
base) instead:
"N digits can't overflow" iff
base**N-1 < 2**32 iff
base**N < 2**32+1
base**N <= 2**32 iff
N <= log(2**32, base)
Assuming exact calculation of log(2**32, base) then
(dubious, really), the floor of that is exactly the maximum
safe N.
The power-of-2 bases, and base 10, should be added to the
tests. We really want to check that _all_ supported bases
work, right? |
|
Date |
User |
Action |
Args |
2007-08-23 15:44:18 | admin | link | issue1335972 messages |
2007-08-23 15:44:18 | admin | create | |
|