Why not FP for Money?

Paul Rubin http
Wed Sep 22 03:34:27 EDT 2004


"John Burton" <john.burton at jbmail.com> writes:
> Yes you could probably "fix" the rounding to make it work in
> practice but the problems is that it is simply not possible to
> represent the value 1.13 in a floating point variable exactly and
> when dealing with money you want to represent it exacctly,
> particularly as it's so easy to do.

The Decimal Floating Point pages that Tim linked to are really fantastic.
I remember going to a talk by some of the MIPS CPU designers a long time
ago, and they explained they left decimal arithmetic out of their RISC
design because they'd instrumented a bunch of Cobol programs and found
that arithmetic simply wasn't where financial applications spent their
computation time.  However, the DFP site shows some pretty interesting
benchmarks.




More information about the Python-list mailing list