Decimal arithmatic, was Re: Python GUI app to impress the boss?
phr-n2002b at NOSPAMnightsong.com
Tue Oct 1 12:20:57 CEST 2002
"James J. Besemer" <jb at cascade-sys.com> writes:
> >>>>(.70 * .05) + .000000001
> >rounds to the right thing.
> Nope. It helps in some cases but introduces errors in other cases
> (e.g., negative numbers).
OK, fix the rounding direction:
if x < 0: sign = -1.0
else: sign = 1.0
return sign * (abs(x) + .00000001)
More information about the Python-list