[Tutor] decimal module and precision

col speed ajarncolin at gmail.com
Tue Feb 1 13:29:43 CET 2011


You can always change the precision in decimal. Just an idea....

On 31 January 2011 22:23, Richard D. Moores <rdmoores at gmail.com> wrote:

>
> Which is accurate to only 16 digits; my Windows Vista calculator gives
> 2.9231329473018093516404474158812 for 23.45**.34
>
> And using mpmath with Python 2.6 does exactly as poorly:
> >>> from mpmath import mp, mpf
> >>> mp.dps=32;mp.pretty=True
> >>> mpf(23.45)**mpf(.34)
> 2.9231329473018095467750783681372
>
> So it seems I shouldn't use d(), or my revised d(), or mpmath for
> maximum precision, which seems to be at least 32 when using the
> decimal module the standard way.
>
> > It would probably be a good idea, if the Python compiler would issue a
> warning
> > when it encounters a `float` constant with excessive precision.
>
> Well, it sure would have helped me!
>
> Thanks, Eike.
>
> Dick
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor
>



--
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20110201/884bfee8/attachment.html>


More information about the Tutor mailing list