HELP: restore my faith in Python

Johann Hibschman johann at physics.berkeley.edu
Mon Mar 13 13:59:08 EST 2000


Ken Seehof writes:
> Johann Hibschman wrote:

>> More seriously, would this whole little discussion be a good reason to
>> put a fixed-precision decimal class into the standard library?  A lot
>> of people want to use floats for money, which is a fairly poor idea
>> unless you know what you're doing.

> Yes, but still dangerous, since people (who don't know what they aredoing)
> will be converting from float to fpd, which will once again bring
> back all the rounding problems (unless they remember to add epsilon).

Not really.  That conversion would be under the control of the fpd
class, which would have a defined precision, and therefore know
exactly how to round the float.

You'd need rules to multiply things with different numbers of decimal
places, or (probably better), you could just call it an error and
provide rounding methods.  Just don't mess with floats.

-- 
Johann Hibschman                           johann at physics.berkeley.edu



More information about the Python-list mailing list