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.

classification
Title: Floating point issue
Type: behavior Stage: resolved
Components: Versions: Python 3.9
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: afw2alan, eric.smith
Priority: normal Keywords:

Created on 2021-08-13 18:26 by afw2alan, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Messages (3)
msg399550 - (view) Author: A wilson (afw2alan) Date: 2021-08-13 18:26
0.01 + 273.15 should equal 273.16 but in python 3.9.5 or earlier report as 273.15999999999997.
msg399561 - (view) Author: Eric V. Smith (eric.smith) * (Python committer) Date: 2021-08-13 20:52
This a limitation of the floating point type that python uses. See https://docs.python.org/3/tutorial/floatingpoint.html
msg399564 - (view) Author: A wilson (afw2alan) Date: 2021-08-13 21:18
Eric,

I was unaware of this document and its implementation in python.

where
0.01+0.15 = 0.16 but 0.01+273.15=273.15999999999997

the latter which should be 273.16 which is triple point temperature of water in Kelvin.

This floating point variance explains some if the conditional test failures I have encountered.

regards

Alan

Get Outlook for Android<https://aka.ms/ghei36>

________________________________
From: report=bugs.python.org@roundup.psfhosted.org <report=bugs.python.org@roundup.psfhosted.org> on behalf of Eric V. Smith <report@bugs.python.org>
Sent: Friday, 13 August 2021, 21:52
To: afw2alan@outlook.com
Subject: [issue44910] Floating point issue

Eric V. Smith <eric@trueblade.com> added the comment:

This a limitation of the floating point type that python uses. See https://docs.python.org/3/tutorial/floatingpoint.html

----------
nosy: +eric.smith
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

_______________________________________
Python tracker <report@bugs.python.org>
<https://bugs.python.org/issue44910>
_______________________________________
History
Date User Action Args
2022-04-11 14:59:48adminsetgithub: 89073
2021-08-13 21:18:38afw2alansetmessages: + msg399564
2021-08-13 20:52:31eric.smithsetstatus: open -> closed

nosy: + eric.smith
messages: + msg399561

resolution: not a bug
stage: resolved
2021-08-13 18:26:29afw2alancreate