Re: [Tutor] decimal module and precision

2011-02-01 Thread Richard D. Moores
On Tue, Feb 1, 2011 at 04:29, col speed wrote: > > You can always change the precision in decimal. Just an idea Not exactly sure what you mean. But I just tried using decimal to get 123.2345274523452345235432452345 ** 2.3 to 300 digits: >>> from decimal import Decimal as D >>> import decimal

Re: [Tutor] decimal module and precision

2011-02-01 Thread col speed
You can always change the precision in decimal. Just an idea On 31 January 2011 22:23, Richard D. Moores 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 p

Re: [Tutor] decimal module and precision

2011-01-31 Thread Richard D. Moores
On Mon, Jan 31, 2011 at 05:24, Eike Welk wrote: > Hello Richard! > > In your code: > >   d(123.2345274523452345235432452345) > > you are entering the number as a `float` and you are loosing the precision > already when the code is compiled. To retain the precision all constants must > be entered a

Re: [Tutor] decimal module and precision

2011-01-31 Thread Eike Welk
Hello Richard! In your code: d(123.2345274523452345235432452345) you are entering the number as a `float` and you are loosing the precision already when the code is compiled. To retain the precision all constants must be entered as strings. For illustration see this part of an interactive

Re: [Tutor] decimal module and precision

2011-01-31 Thread Richard D. Moores
On Mon, Jan 31, 2011 at 01:32, Steven D'Aprano wrote: > Richard D. Moores wrote: >> >> Python 3.1 >> The decimal module continues to puzzle me from time to time. Here's >> one of those. I want to use Alex Martelli's factory function as much >> as possible. Turns out it has a problem with precision

Re: [Tutor] decimal module and precision

2011-01-31 Thread Steven D'Aprano
Richard D. Moores wrote: Python 3.1 The decimal module continues to puzzle me from time to time. Here's one of those. I want to use Alex Martelli's factory function as much as possible. Turns out it has a problem with precision in addition and multiplication.

[Tutor] decimal module and precision

2011-01-30 Thread Richard D. Moores
Python 3.1 The decimal module continues to puzzle me from time to time. Here's one of those. I want to use Alex Martelli's factory function as much as possible. Turns out it has a problem with precision in addition and multiplication. = from decimal import D