[New-bugs-announce] [issue41920] Weird add operation of "0.2222 + 0.1111"

Leonard Schwennesen report at bugs.python.org
Sat Oct 3 07:39:41 EDT 2020


New submission from Leonard Schwennesen <l.schwennesen at gmx.net>:

If I add 0.2222 + 0.1111 in the python cli I get the value 0.33330000000000004 and not 0.3333. Also the other way around.
But if I enter for example 0.22222+0.11111 I get 0.33333 so that's right.
Here are a few examples I tested that working properly:

>>> 0.22+0.11
0.33
>>> 0.222+0.111
0.333
>>> 0.22222+0.11111
0.33333
>>> 0.3333+0.7777
1.111
>>> 0.3333+0.6666
0.9999
>>> 0.3333+0.3333
0.6666
>>> 0.6666+0.1111
0.7777
>>> 0.2222+0.3333
0.5555

Python 3.8.5
[GCC 10.2.0] on linux

I also tested that in a newly setup VM, same issue

----------
messages: 377871
nosy: ungedummt
priority: normal
severity: normal
status: open
title: Weird add operation of "0.2222 + 0.1111"
type: behavior
versions: Python 3.8

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue41920>
_______________________________________


More information about the New-bugs-announce mailing list