In article <[EMAIL PROTECTED]>,
        Rick Myers <[EMAIL PROTECTED]> writes:
> On Apr 13, 2002 at 11:45:33 +0000, Ton Hospel wrote:
>> 
>> The really interesting entry is in fact the one by Rick Myers 
>> because it can be trivially improved to 54:
>> 
>> -l for$.(++$_..pop){s!.!$.*"$&.$'"%($`?10:$^T)!eg}print
> 
> Hmm.. Well, the ++$_ would've been good for 60, but the twist
> of moving $& inside the double quotes breaks for me with
> input values >= 45.
> 
> The problem is that as $& grows in length, it pushes the
> trailing digits of $' past were perl will "see" them when it
> converts the value to float (for the *). The conversion back
> to int (by the %) then causes an off-by-one type rounding
> error.
> 
> In other words, at 45, for the last non-zero digit...
> 
>     $.*$&+$.*".$'" == 126
> 
>     $.*"$&.$'" == 125.9999999999999857891452847979962825775146484375
> 

Interesting, so it in fact depends critically on the number of
significant digits in a double.

So we have two 60's that you can really run through the test program.
Still, is there a way to fudge it and work around the float mess...

Reply via email to