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: Roundoff error on OS X
Type: behavior Stage: resolved
Components: Interpreter Core, macOS Versions: Python 3.4, Python 2.7
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: Michał Jan Warecki, ezio.melotti, ned.deily, ronaldoussoren
Priority: normal Keywords:

Created on 2015-10-11 22:41 by Michał Jan Warecki, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Messages (2)
msg252828 - (view) Author: Michał Jan Warecki (Michał Jan Warecki) Date: 2015-10-11 22:41
This should speak for itself:

>>> 3*4.35
13.049999999999999
>>> 

The error is reproducible, and applies to all decimal numbers ending with \.[0-9]5, and \.[0-4] as well as \.[6-9], when multiplied by 3. Examples:

>>> 3*4.1
12.299999999999999
>>> 3*4.4
13.200000000000001
>>> 3*4.6
13.799999999999999
>>> 3*4.8
14.399999999999999
>>> 3*4.9
14.700000000000001
>>> 4*3.1
12.4
>>> 4*4.1
16.4
>>> 3*4.1
12.299999999999999
>>> 6*4.1
24.599999999999998
>>> 6*4.4
26.400000000000002
>>>
msg252829 - (view) Author: Ezio Melotti (ezio.melotti) * (Python committer) Date: 2015-10-11 22:42
See https://docs.python.org/3/tutorial/floatingpoint.html
History
Date User Action Args
2022-04-11 14:58:22adminsetgithub: 69565
2015-10-11 22:42:30ezio.melottisetstatus: open -> closed

nosy: + ezio.melotti
messages: + msg252829

resolution: not a bug
stage: resolved
2015-10-11 22:41:22Michał Jan Wareckisetcomponents: + Interpreter Core
2015-10-11 22:41:00Michał Jan Wareckicreate