[Python-Dev] Re: Decimal data type issues

Moore, Paul Paul.Moore at atosorigin.com
Fri Apr 23 05:42:31 EDT 2004

From: Tim Delaney
> I think we probably want a supplemental PEP for upgrading the `math`
> module plus appropriate builtins (like round) to handle Decimal. A
> quick scan through the docs reveals

While I'm sure the numerical properties are iffy, just how bad is using
binary FP as an intermediate when calculating transcendental functions
for Decimal values?

I'm thinking of something like

    d = Decimal(...)
    f = math.sin(float(d))
    # Now convert back using exact float->Decimal, followed by
    # context-respecting "+" operation
    result = +Decimal.from_float(f)

I suspect that this is adequate for "casual" users. And I'm not at all
sure that the target audience for a Decimal type really cares about
transcendental functions...

(I think that boils down to claiming YAGNI, at least in the first


This e-mail and the documents attached are confidential and intended 
solely for the addressee; it may also be privileged. If you receive this 
e-mail in error, please notify the sender immediately and destroy it.
As its integrity cannot be secured on the Internet, the Atos Origin group 
liability cannot be triggered for the message content. Although the 
sender endeavours to maintain a computer virus-free network, the sender 
does not warrant that this transmission is virus-free and will not be 
liable for any damages resulting from any virus transmitted.

More information about the Python-Dev mailing list