+ 1

# Why are calculations in Python wrong? (SOLVED)

When I type 3.3- 3, the answer is not 0.3 but 0.299 something. Same with 2.2-2 etc. What exactly is wrong? Why is this happening?

2 Respostas

+ 5

This is because of famous floating point error (occurs in almost all languages that support floating point arithmetic)
Read this for more info about it👇
https://docs.python.org/2/tutorial/floatingpoint.html

+ 2

Thank you so much for this.