Why not FP for Money?

Dan Bishop danb_83 at yahoo.com
Tue Sep 21 20:11:22 EDT 2004

"John Roth" <newsgroups at jhrothjr.com> wrote in message news:<10l0lpt9n0n5k9c at news.supernews.com>...
> "Chris Barker" <Barkmann at gmail.com> wrote in message 
> news:cc887c1d.0409202325.76ec2227 at posting.google.com...
> > Hi all,
> >
> > I promise this is not a troll... Really, it's embarassing, because
> > this is one Engineer that DID take a Numerical Analysis course, and
> > from William Kahan, no less, and I still don't really get it. (and
> > yes, Alex, I could have gotten my degree without it)
> It seems your course didn't make the one crucial distinction
> that should be written in letters of fire at the start of every
> discussion of floating point.
> Floating point arithmetic is useful for continuous quantities,
> or quantities that are measured (as in weighed, etc.) Integers
> (and rationals) are useful for things that are counted, which
> includes currency units, but also includes anything else that
> comes in discrete units  (apples and oranges, for instance).

And the confusion comes from the fact that money is pretty much the
only thing that uses "continuous quantity" decimal-point notation to
represent a discrete thing.

But what about countries like Japan and (even more so) Turkey where
the currency units are so small that you never use fractions of them? 
Do programmers there talk less about floating-point error?

More information about the Python-list mailing list