math module for Decimals

Steven D'Aprano steve at REMOVE-THIS-cybersource.com.au
Sun Dec 28 08:28:55 CET 2008


On Sun, 28 Dec 2008 06:58:18 +0000, Steven D'Aprano wrote:

> def make_decimal(f, precision=16):
>     # choose how many decimal places you want to keep return
>     Decimal.from_float(f, precision)

Ah crap, I forgot that from_float() has been left out of the decimal API. 
That's very annoying.

Sorry about that.


-- 
Steven



More information about the Python-list mailing list