Decimal arithmetic, was Re: Python GUI app to impress the boss?

Greg Ewing see_reply_address at something.invalid
Thu Oct 3 22:02:53 EDT 2002


John Roth wrote:

> The best prior art I can figure is from COBOL, where most of this
> stuff happens today. There, the rounding policy is set by the _result_
> picture, which is a concept that simply isn't availible in Python


Perhaps intermediate results could be
accumulated using arbitrary precision,
and then a rounding function of your
choice applied, e.g.

   d = bankers_round(a * b + c, 2)

-- 
Greg Ewing, Computer Science Dept,
University of Canterbury,	
Christchurch, New Zealand
http://www.cosc.canterbury.ac.nz/~greg




More information about the Python-list mailing list