extend methods of decimal module
Mark H. Harris
harrismh777 at gmail.com
Fri Feb 28 06:18:49 CET 2014
On Thursday, February 27, 2014 10:26:59 PM UTC-6, Chris Angelico wrote:
> Create Decimal values from strings, not from the str() of a float,
> which first rounds in binary and then rounds in decimal.
Thanks Chris... another excellent point... ok, you guys have about convinced me (which is spooky) but, hey, I'm teachable... what is the best strategy then? Many of the functions of my dmath.py are algorithms which calculate infinite series to convergence out there at some number of precision ... do I make the assumption that all functions will take a string as argument and then let interactive users bare the responsibility to enter a string or decimal... avoiding floats... or use try and toss and error if the rules are not followed, or what? I do see that I'm trying to solve a problem the wrong way,... just not sure what is the better approach.
If you get a chance, take a look at the dmath.py code on:
I got the repository working correctly for me, and the files can be viewed on-line ... its a long script, but not that hard to look through because all the functions pretty much work the same... when you've seen one converging series function in python you've seen them all!
Thanks again, Chris.
More information about the Python-list