This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author steven.daprano
Recipients Au Vo, mark.dickinson, remi.lapeyre, rhettinger, skrah, steven.daprano, tim.peters
Date 2019-02-18.23:29:07
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1550532547.24.0.488804072552.issue36028@roundup.psfhosted.org>
In-reply-to
Content
Changing the title from referring to "decimal" to "float", since this has nothing to do with the decimal module or Decimal type.

Like Raymond and Tim, I too cannot reproduce the claimed difference in behaviour between Python 2.7 and 3.x.

Au Vo, there are many resources on the web explaining why floats such as 0.4 do not equal exactly four tenths. One of the best (but not the easiest to understand) is 

What Every Computer Scientist Should Know About Floating-Point Arithmetic 

https://docs.oracle.com/cd/E19957-01/806-3568/ncg_goldberg.html

A more accessible (to me at least) resource is Bruce Dawson's blog:

https://randomascii.wordpress.com/category/floating-point/page/1/

although it is written from the perspective of a C programmer.

There's also a Python FAQ about it:

https://docs.python.org/3/faq/design.html#why-are-floating-point-calculations-so-inaccurate
History
Date User Action Args
2019-02-18 23:29:07steven.dapranosetrecipients: + steven.daprano, tim.peters, rhettinger, mark.dickinson, skrah, remi.lapeyre, Au Vo
2019-02-18 23:29:07steven.dapranosetmessageid: <1550532547.24.0.488804072552.issue36028@roundup.psfhosted.org>
2019-02-18 23:29:07steven.dapranolinkissue36028 messages
2019-02-18 23:29:07steven.dapranocreate