Decimal arithmatic, was Re: Python GUI app to impress the bos s?

Delaney, Timothy tdelaney at
Wed Sep 25 19:50:41 EDT 2002

> From: danb_83 at [mailto:danb_83 at]
> "Stuart D. Gathman" <stuart at> wrote in message 
> news:<amo0aq$5nf$1 at>...
> >...
> > There ought to be severe penalties for idiots that use 
> floating point
> > dollars for financial applications.  If forced to use floating point
> > (e.g. because customer demands BASIC), then keep money amounts in
> > whole pennies (or whatever the smallest currency unit for 
> the country
> > is), and divide by 100 (or whatever) for printing only (or 
> just add the
> > decimal point yourself).
> That's exactly how things were done at my old workplace, except that
> cents were also used for user input.  Most of the time.

It's called Fixed Point arithmetic, and strangely enough, Tim Peters wrote
an excellent implementation ...

Tim Delaney

More information about the Python-list mailing list