math module for Decimals

jerry.carl.mi at gmail.com jerry.carl.mi at gmail.com
Sun Dec 28 11:41:22 EST 2008


> 1. mpmath?
> 2. sympy?
> 3. Sage?

Haven't tried those, i guess i have some studying to do.


>
> > x=Decimal.__mod__(x,Decimal('2')*pi())
>
> > Works fine for what i need, but i am sure it's not the right way to do
> > it.
>
> I don't know of any better way to deal with large arguments.
> The main problem is that the reduction step can introduce fairly
> large errors:  for example, if you're using a value of pi
> that's accurate to 10**-20, say, then reducing something of
> magnitude 10**5*pi will give a result with error of around
> 10**-15.  As far as I know, this problem is essentially
> unavoidable, and it's the reason why implementing sin for inputs
> like 10**999999999 isn't feasible.

Good point. No tool will work in all parts of the universe (which is
especially true for the universal ski wax).

Let me check the 3 modules you listed above!



More information about the Python-list mailing list