Have u ever tried this: 0.1 + 0.2?

So you think Python is amazing bla, bla… So do I , BUT have you ever tried this?
0.1 + 0.2
give it a go, the result won’t be 0.3 !
after you do, here’s some reading:
https://docs.oracle.com/cd/E19957-01/806-3568/ncg_goldberg.html

Hi, @adam.kubalica

This isn’t a Python problem, but the peculiarities of float calculations that exist in any programming language.
This may come as a surprise to you, but in operations requiring high accuracy, they try not to use float operations. In finance, for example.

If it came as such a surprise to you. Study how languages with strict typing behave when data type overflow occurs.

2 Likes