>>>>> "m" == mailbox <> writes:
m>
wrote:
>> On my machine, your test also passes for 55, but a more rigorous test
>> does not:
>>
>> $ perl -le '$foo=55; print((2**$foo+30)-(2**$foo+25))'
>> 8
>>
>> I'm pretty sure that 5 != 8, so 55 bits is right out. On my machine, 52 is
>> high as I would go.
>>
>> $ perl -le '$foo=52; foreach (1..1e7) { my $y =
>> ((2**$foo+$_+1)-(2**$foo+$_));
>> die $_ unless $y == 1}'
m> Thanks for that improvement! It behaves the same on our machine as on
m> yours. Fortunately, 52 bits is still plenty of magnitude for our
m> purposes.
it would be hard to use a cpu today that doesn't use ieee float formats
(any perl vax users around?

. so that mantissa size for double floats
(64 bits) will be the same for almost any common box today.
and this one liner also shows the transition from integers to float:
perl -le "print '2**', \$_, ': ', 2**\$_, ' - 1 = ', 2**\$_ - 1 for 47 .. 52"
notice that the -1 stops working after 49 bits so that is the largest
integer you can store in a double. note that this is a decimal issue so
even if the mantissa is 53 bits, you can't operate with a 1 (decimal)
because it takes 4 bits to hold a decimal digit. this is why this shows
49 usable (in decimal) integer bits but the ieee format has 53 bits in
the mantissa.
uri
--
Uri Guttman ------
--------
http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs ----------------------------
http://jobs.perl.org