Float DataType in Python | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Float DataType in Python

Why >>> (1.1 + 2.2) == 3.3 False >>> (1.1 +1.2)==2.3 True I know 0.1 corresponds to 0.000110011001100110011... in binary thus first one is False but this should also happen with second.

26th May 2019, 3:04 PM
harshit
harshit - avatar
1 Answer
0
Because the actual answer of the first one is: 3.3000000000000003 NOT: 3.3 Unlike the second one It's actually: 2.3
26th May 2019, 9:12 PM
Majd Suhail
Majd Suhail - avatar