From: Robert McGovern Date: 2002-12-10T21:27:57+09:00 Subject: Re: warnings -w > The problem is that two-tenths (0.2) cannot be exactly represented as a > binary floating point number. When you look at the details, the number > 0.2 is just really ... > > >> "%.20f" % 0.2 > => "0.20000000000000001110" > > ... or just a shade larger than two-tenths. Therefore, when you divide > 2.4 by something just a bit larger that two-tenths, you get something > just a bit smaller than 12... > > >> "%.20f" % (2.4 / 0.2) > => "11.99999999999999822364" > > This is a consequence of representing numbers in floating point and is > common whenever dealing with floating point numbers. Last week at work, > I came across a situation where a sum of monetary amounts were off by a > penny ... Yes, they were using floating point to represent dollar > amounts. Never a good idea. Duh forgot about that, wish I'd recieved this before I sent my mail out. *sigh*