>>> 1.2*3==3.6
False
>>> 1.2*3==3.6
False
>>> 1.2*3
3.5999999999999996
>>> 1.2*3
3.5999999999999996
>>> 3.5*4
14.0
>>> 1.2*4
4.8
>>> 1.2*2
2.4
Asked
Active
Viewed 24 times
0

phuclv
- 37,963
- 15
- 156
- 475
-
In Python, you can use [`decimal`](https://docs.python.org/3/library/decimal.html) if this behaviour is a problem for you. – Amadan Apr 11 '22 at 03:43
-
FP can represent many values. 3.6 is not in that set. The closest value it can represent is about 3.5999999999999996.... – chux - Reinstate Monica Apr 11 '22 at 04:09