[Python-Dev] Mixing float and Decimal -- thread reboot

Raymond Hettinger raymond.hettinger at gmail.com
Sun Mar 21 19:31:06 CET 2010

On Mar 20, 2010, at 9:40 PM, Greg Ewing wrote:

> Mark Dickinson wrote:
>> Except that float is fixed-width (typically 53 bits of precision),
>> while Decimal allows a user-specified, arbitrarily large, precision;
> Yes, but it still has *some* fixed limit at any given
> moment, so the result of an operation on Decimals always
> has the potential to produce an inexact result. It's
> not like an int or Fraction where the result can expand
> to whatever size is needed.

I'm thinking that I need to do more work on the Decimal
documentation.  There still seems to be a profound
misunderstanding of its capabilities (i.e. that an Inexact
flag can be set to preclude any inexact operations,
that the precision can be automatically extended as
needed during a calculation, or that many types of 
calculations can be done exactly especially if 
floor division is used).  If rounded is needed, it
can be controlled explicitly.


More information about the Python-Dev mailing list