monetary applications [was: Python GUI app to impress the bos s?]

Paul Rubin phr-n2002b at NOSPAMnightsong.com
Fri Sep 20 05:05:57 EDT 2002


Alex Martelli <aleax at aleax.it> writes:
> Using double binary floating-point, the result of 0.70 x 1.05 is 
> 0.73499999999999998667732370449812151491641998291015625; the result should 
> have been 0.735 (which would be rounded up to $0.74) but instead the 
> rounded result would be $0.73.

Interesting.

> Should your business get tax-audited, inspectors may take a dim view
> of your shaving a cent off the sales tax due on each and every item
> you sell to the public at $0.70 -- "I found it hard to imagine" how
> rounding effects might affect the result (when the law specifies
> rounding to the nearest cent and always rounding half cents up) may
> not be an acceptable defense.

I don't think they ask or care whether you round up or down on
individual 70 cent items.  They want to know the total value of the
stuff you sold, and then the tax you pay is X percent of that total,
for whatever your local value of X is.



More information about the Python-list mailing list