According to python3, this answer seems to be ** 2.67 **. Hmm, stupid. ..
When I thought about it, there were many other examples like this.
test.py
2.2 + 2.1 #4.300000000000001
7.6 + 8.7 #16.299999999999997
It seems that python is written in C language, and as a result, it seems that such an unclear calculation result is returned.
The procedure on the back side when calculating float is like this.
So, there seems to be a slight error in the timing of conversion from fractions to decimals.
I had the option of doubting this if something strange happened around the numbers.
I wonder if I'm addicted to a bug in a system I made without knowing this lol
Recommended Posts