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: Basic subtraction is wrong ( 1.83 - 1.52 == 0.31000000000000005)
Type: Stage: resolved
Components: Versions: Python 3.7, Python 2.7
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: René Podlogar, mark.dickinson
Priority: normal Keywords:

Created on 2017-06-25 09:14 by René Podlogar, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Messages (2)
msg296817 - (view) Author: René Podlogar (René Podlogar) Date: 2017-06-25 09:14
My Python-Installations Python 2.7.12, Python 3.4.5 @linux64
and the CLI on the (interactive shell) affected:

Python 3.6.0 (default, Jan 13 2017, 00:00:00) 
[GCC 4.8.4] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> 1.83 - 1.52

Expected= 0.31

Verified in irc-channel
msg296818 - (view) Author: Mark Dickinson (mark.dickinson) * (Python committer) Date: 2017-06-25 09:44
This is working as expected. Python's floats use the hardware-provided _binary_ floating-point format, which can't represent every finite decimal value exactly. I recommend reading for more information.
Date User Action Args
2022-04-11 14:58:48adminsetgithub: 74937
2017-06-25 09:44:13mark.dickinsonsetstatus: open -> closed

nosy: + mark.dickinson
messages: + msg296818

resolution: not a bug
stage: resolved
2017-06-25 09:14:37René Podlogarcreate