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.

Title: Add an FAQ note about floating point representation
Type: Stage: resolved
Components: Documentation Versions: Python 3.8
Status: closed Resolution: out of date
Dependencies: Superseder:
Assigned To: docs@python Nosy List: docs@python, martin.panter, rhettinger, xtreak
Priority: normal Keywords:

Created on 2018-10-09 10:06 by xtreak, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Messages (3)
msg327390 - (view) Author: Karthikeyan Singaravelan (xtreak) * (Python committer) Date: 2018-10-09 10:06
There have been tickets raised due to floating point representation being misleading where "0.1 + 0.2" returns 0.30000000000000004 and "0.1 + 0.3" returns 0.4. This is explained at [0] but I think it's worth to add this as a question to FAQ and link to the tutorial and possibly to some external links like [1] and [2] so that the user can understand the limitation instead of assuming it's a bug in CPython. Searching for "floatingpoint.html" gives 64 issues [4] were the documentation was linked out of which 3 were reported in the past one month.

If there is also any other page where this can be linked to get better visibility then this could avoid a lot of confusion especially for beginners where "0.1 + 0.3" silently seems to work fine but "0.1 + 0.2" has a misleading representation along with variations in other floating point arithmetic operations making the user think it's a CPython bug.

Adding Raymond to see if it's worth adding it in FAQ or any other place and also that he might have more feedback on teaching users and wording this in a better way.

msg327392 - (view) Author: Martin Panter (martin.panter) * (Python committer) Date: 2018-10-09 10:32
Have you seen <>? It already links to the tutorial.
msg327393 - (view) Author: Karthikeyan Singaravelan (xtreak) * (Python committer) Date: 2018-10-09 10:37
Thanks Martin, I was searching in the general and programming FAQ for this and did a general search with the link and nothing showed up in the bug tracker or search engine in FAQ. My bad, I will close this.
Date User Action Args
2022-04-11 14:59:06adminsetgithub: 79123
2018-10-09 11:13:59serhiy.storchakasetresolution: fixed -> out of date
2018-10-09 10:37:58xtreaksetstatus: open -> closed
resolution: fixed
messages: + msg327393

stage: resolved
2018-10-09 10:32:11martin.pantersetnosy: + martin.panter
messages: + msg327392
2018-10-09 10:06:51xtreakcreate