Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Floating point issue #89073

Closed
afw2alan mannequin opened this issue Aug 13, 2021 · 3 comments
Closed

Floating point issue #89073

afw2alan mannequin opened this issue Aug 13, 2021 · 3 comments
Labels
3.9 only security fixes type-bug An unexpected behavior, bug, or error

Comments

@afw2alan
Copy link
Mannequin

afw2alan mannequin commented Aug 13, 2021

BPO 44910
Nosy @ericvsmith

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = None
closed_at = <Date 2021-08-13.20:52:31.071>
created_at = <Date 2021-08-13.18:26:29.245>
labels = ['type-bug', 'invalid', '3.9']
title = 'Floating point issue'
updated_at = <Date 2021-08-13.21:18:38.319>
user = 'https://bugs.python.org/afw2alan'

bugs.python.org fields:

activity = <Date 2021-08-13.21:18:38.319>
actor = 'afw2alan'
assignee = 'none'
closed = True
closed_date = <Date 2021-08-13.20:52:31.071>
closer = 'eric.smith'
components = []
creation = <Date 2021-08-13.18:26:29.245>
creator = 'afw2alan'
dependencies = []
files = []
hgrepos = []
issue_num = 44910
keywords = []
message_count = 3.0
messages = ['399550', '399561', '399564']
nosy_count = 2.0
nosy_names = ['eric.smith', 'afw2alan']
pr_nums = []
priority = 'normal'
resolution = 'not a bug'
stage = 'resolved'
status = 'closed'
superseder = None
type = 'behavior'
url = 'https://bugs.python.org/issue44910'
versions = ['Python 3.9']

@afw2alan
Copy link
Mannequin Author

afw2alan mannequin commented Aug 13, 2021

0.01 + 273.15 should equal 273.16 but in python 3.9.5 or earlier report as 273.15999999999997.

@afw2alan afw2alan mannequin added 3.9 only security fixes type-bug An unexpected behavior, bug, or error labels Aug 13, 2021
@ericvsmith
Copy link
Member

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

@afw2alan
Copy link
Mannequin Author

afw2alan mannequin commented Aug 13, 2021

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: [bpo-44910] 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\>


@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.9 only security fixes type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

1 participant