Why 0.1 + 0.2 != 0.3 in python | Sololearn: Learn to code for FREE!
Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren
+ 5

Why 0.1 + 0.2 != 0.3 in python

0.1 + 0.2 == 0.3 Output :- False

15th Jul 2021, 10:41 AM
pallavi
5 Antworten
+ 3
Because print(0.1 + 0.2) = 0.30000000000000004
15th Jul 2021, 10:45 AM
A͢J
A͢J - avatar
+ 2
because impossibility to store some decimal values as binary floating point numbers without loosing accuracy ^^ https://lemire.me/blog/2020/10/10/why-is-0-1-0-2-not-equal-to-0-3/
15th Jul 2021, 4:51 PM
visph
visph - avatar
0
Value is changed after addition of points value..
15th Jul 2021, 10:55 AM
Kshitiz
Kshitiz - avatar
0
Use function to round off your addition
15th Jul 2021, 2:50 PM
🌀 Shail Murtaza شعیل مرتضیٰ
🌀 Shail Murtaza شعیل مرتضیٰ - avatar
0
Sweety Pico It's just a floating point error.
17th Jul 2021, 8:01 AM
Calvin Thomas
Calvin Thomas - avatar