Python is DOOMED! Again!

Chris Angelico rosuav at gmail.com
Fri Jan 23 06:38:17 EST 2015


On Fri, Jan 23, 2015 at 9:59 PM, Steven D'Aprano
<steve+comp.lang.python at pearwood.info> wrote:
> I don't think that a raise of 0.10000000000000001 (10%),
> 0.035000000000000003 (3.5%) or 0.070000000000000007 (7%) is quite what
> people intended.
>
> :-)

I also don't think it'll make any appreciable difference, especially
if the actual salary is stored as an integer :-)

> (Don't use binary floating point numbers for anything related to money. Just
> don't.)

While I generally agree, it's not quite as hard-and-fast as that. It's
just important to know that binary floating point can't accurately
represent many commonly-used real numbers... the same consideration
that they always need.

ChrisA



More information about the Python-list mailing list