[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,
>>
[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,
> inste
[Tim Peters]
>> For a fun :-) exercise, prove that the number of trailing zeroes in n!
>> is the sum, from i = 1 to infinity, of n // 5**i (of course as soon as
>> you reach a value of i such that n < 5**i, the quotient is 0 at that i
>> and forever after).
>>
>> In this case,
>>
>> 100 // 5 + 100
Tim Peters wrote:
> [Dick Moores, computes 100 factorial as
>
> 9332621544394415268169923885626670049071596826438162146859296389521753229915608941463976156518286253697920827223758251185210916864
>
> but worries about all the trailing zeros]
>
>> Yes, I'm sure you a
[Dick Moores, computes 100 factorial as
9332621544394415268169923885626670049071596826438162146859296389521753229915608941463976156518286253697920827223758251185210916864
but worries about all the trailing zeros]
> Yes, I'm sure you are. I'd forgotten about all tho
At 04:50 PM 8/18/2006, Christian Tschabuschnig wrote:
> >>
> 9332621544394415268169923885626670049071596826438162146859296389521753229915608941463976156518286253697920827223758251185210916864
> >>> Still not exactly correct! I'm bewildered.
> >>>
> >> The results look t
>> 9332621544394415268169923885626670049071596826438162146859296389521753229915608941463976156518286253697920827223758251185210916864
>>> Still not exactly correct! I'm bewildered.
>>>
>> The results look the same to me
>> why do you think they're not correct?
>> what is
At 04:24 PM 8/18/2006, Luke Paireepinart wrote:
>Dick Moores wrote:
> > But here's the revised precisionFactorial.py:
> >
> >
> > # 1precisionFactorial.py
> >
> > import decimal
> >
> > def d(x):
> > return decimal.Decimal(str(x))
> >
> > def fact(n):
> > product
Dick Moores wrote:
> At 02:41 PM 8/18/2006, Bob Gailer wrote:
>
>> Dick Moores wrote:
>>
>>> As an exercise that I thought would help me understand the decimal
>>> module, I've been trying write a script (precisionFactorial.py)
>>> that uses a modified fact(n) to compute precise factorial
At 02:41 PM 8/18/2006, Bob Gailer wrote:
>Dick Moores wrote:
>>As an exercise that I thought would help me understand the decimal
>>module, I've been trying write a script (precisionFactorial.py)
>>that uses a modified fact(n) to compute precise factorials
>What do you mean by "precise factorials
Dick Moores wrote:
> As an exercise that I thought would help me understand the decimal
> module, I've been trying write a script (precisionFactorial.py) that
> uses a modified fact(n) to compute precise factorials
What do you mean by "precise factorials"? Python's long integer should
handle th
As an exercise that I thought would help me understand the decimal
module, I've been trying write a script (precisionFactorial.py) that
uses a modified fact(n) to compute precise factorials using the
decimal module. I''m getting nowhere fast, and don't understand why.
Here's what I have so far:
12 matches
Mail list logo