about presicion

Paul Miller pwmiller1 at adelphia.net
Thu Aug 26 23:12:02 EDT 2004


alikakakhel3 at hotmail.com (Ali) wrote in message news:<8f17f4bc.0408261434.1a73e874 at posting.google.com>...
> I was wondering if it was posible to get very good presicion. I mean
> like to the to the 100 th or more decimal place. if so how?

You can have infinite, or at least arbitrary precision, if you do all
calculations on rational numbers.  Doing this will probably be very
slow compared to calculations on floats, ints, or longs, however,
especially if implemented in pure Python.

A compromise would be to use a fixed-point representation.  If you
needed 100 decimal digits after the decimal point, and say, 10 before
the decimal point, you could accomplish that (and actually a teeny bit
more) using a 368-bit fixed-point representation.  This could possibly
be fast in Python, depending on the implementation.

It all depends what your requirements are.



More information about the Python-list mailing list