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: Arithmetic/precision bug when using floating-point numbers
Type: behavior Stage: resolved
Components: Interpreter Core Versions: Python 3.4
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: ezio.melotti, videogames4all
Priority: normal Keywords:

Created on 2015-09-01 06:49 by videogames4all, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
weirdpythonbug.py videogames4all, 2015-09-01 06:49 Example script showing error
Messages (2)
msg249458 - (view) Author: Andrew (videogames4all) * Date: 2015-09-01 06:49
I just recently discovered this bug, but when adding or subtracting a number and a precision error occurs when using at least 1 floating-point number in the operation. For example, 1 - 0.98 should output 0.02, but instead outputs 0..020000000000000018 (at least on my machine).

Included is a simple script showing what happens, just when incrementing or decrementing by 0.01 from 0 to 1.

I am running Python 3.4.3 on a 64-bit Arch Linux machine.
msg249459 - (view) Author: Ezio Melotti (ezio.melotti) * (Python committer) Date: 2015-09-01 06:51
Thanks for the report, however this is not a Python bug.
See: https://docs.python.org/3/tutorial/floatingpoint.html
History
Date User Action Args
2022-04-11 14:58:20adminsetgithub: 69164
2015-09-01 06:51:59ezio.melottisetstatus: open -> closed

nosy: + ezio.melotti
messages: + msg249459

resolution: not a bug
stage: resolved
2015-09-01 06:49:42videogames4allcreate