Precise calculations

Alex Martelli aleaxit at
Sat Nov 8 00:22:32 CET 2003

Ben Finney wrote:
>> Could anybody help me on how to do precise calculations with Python
>> the way hand-held calculators do?
> Use rounding, e.g. as implemented by the str() function.  From the above

Use str if you really want to do like hand-held calculators, i.e., hide some
digits.  If you want really high precision in binary floating point, the 
gmpy extension module may be useful; if in decimal floating point, there is
a class Decimal that's being worked on to eventually provide that, too.


More information about the Python-list mailing list