0

When in python3 I add 0.1 to 0.1, I get 0.2. But when I add 0.2 to 0.1 I get 0.30000000000000004. What is the problem? How it works?

>>> 0.1+0.1
0.2
>>> 0.1+0.2
0.30000000000000004
>>>
  • Also mandatory [Floating Point Arithmetic: Issues and Limitations](https://docs.python.org/3/tutorial/floatingpoint.html) – buran Feb 18 '22 at 09:49
  • 1
    [0.30000000000000004 is an excellent search term](https://www.google.com/search?q=%220.30000000000000004%22) – Pychopath Feb 18 '22 at 09:49

0 Answers0