[New-bugs-announce] [issue40981] increment is wrong in 3.7

mike stern report at bugs.python.org
Mon Jun 15 01:36:56 EDT 2020


New submission from mike stern <rskiredj at hotmail.com>:

I noticed i big problem making a simple increment of .1 in python 3.7
using while
the result is wrong

i=0
while i < 1.2:
    i += 0.1
    print(i)

result

== RESTART: C:/Users/icosf/AppData/Local/Programs/Python/Python37-32/bb.py ==
0.1
0.2
0.30000000000000004
0.4
0.5
0.6
0.7
0.7999999999999999
0.8999999999999999
0.9999999999999999
1.0999999999999999
1.2

what the heck is going on, can someone explain to me

----------
assignee: terry.reedy
components: IDLE
messages: 371519
nosy: rskiredj at hotmail.com, terry.reedy
priority: normal
severity: normal
status: open
title: increment is wrong in 3.7
type: behavior
versions: Python 3.7

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


More information about the New-bugs-announce mailing list