Python -- floating point arithmetic

Adam Skutt askutt at gmail.com
Thu Jul 8 09:00:48 EDT 2010


On Jul 8, 7:23 am, Mark Dickinson <dicki... at gmail.com> wrote:
> On Jul 8, 11:58 am, Adam Skutt <ask... at gmail.com> wrote:
>
> > accurately.  Moreover, in general, it's impossible to even round
> > operations involving transcendental functions to an arbitrary fixed-
> > precision, you may need effectively infinite precision in order to the
> > computation.
>
> Impossible?  Can you explain what you mean by this?  Doesn't the
> decimal module do exactly that, giving correctly-rounded exp() and
> log() results to arbitrary precision?
You run into the table-maker's dilemma: there's no way to know in
advance how many digits you need in order to have n bits of precision
in the result.  For some computations, the number of bits required to
get the desired precision can quickly overwhelm the finite limitations
of your machine (e.g., you run out of RAM first or the time to compute
the answer is simply unacceptable).

Adam



More information about the Python-list mailing list