[Tutor] Having trouble getting mind around decimal module

Dick Moores rdm at rcblue.com
Mon Aug 14 08:30:37 CEST 2006

I'm having trouble getting my mind around the decimal module. From 
the tutorial (<http://docs.python.org/lib/decimal-tutorial.html>) I 
can see how to get 1/7 to, say, 32 places:

 >>> from decimal import Decimal
 >>> getcontext().prec = 32
 >>> Decimal(1) / Decimal(7)

But I can't figure out how to compute to 32 places things like the 
square root of 2, or the arc tangent of .41. Could someone please show me?


Dick Moores
rdm at rcblue.com

More information about the Tutor mailing list