[Tutor] puzzled again by decimal module

Christian Tschabuschnig tschaboo at gmx.at
Sat Aug 19 04:13:02 CEST 2006


[Tim Peters]
> You would in this case, and that would be wrong.  In fp you'd get an
> approximation to the exact n * (1./5 + 1./5**2 + ...)  == n/4. (use
> the rule for the sum of an infinite geometric series).  For example,
> that way you'd compute that 4! == 24 has 4/4 == 1 trailing zero,
> instead of the correct 4 // 5 == 0 trailing zeroes, and that 9! ==
> 362880 has 9/4 == 2.25 trailing zeroes instead of the correct 9 // 5
> == 1 trailing zero.

well ... you're right, of course.

> Nope again.  Count the number of trailing zeros in 100! more carefully.

since i'm not able to count further than to 10 past midnight, i used
echo -n "000000000000000000000000" | wc -c
to do the work. and because i'm a confused person i forgot the "-n" :-)

good night,
christian




More information about the Tutor mailing list