3/22/2019 9:02:02 PM
I'm no expert in PHP, but I'm guessing it has to do with floating-point values being approximations. So in other words: maybe 0.3 is actually stored as 0.30000000003.
Because float numbers have a specific accuracy of their representation. You can find more info here: http://php.net/manual/en/language.types.float.php
Hope it helps you.
Follow this link:
So in this case, what is the best way to compare for equality? a) multiplying each by 10 or 100 and casting to integers or b) checking if the sum on the left lies within a small tolerance of the value on the right hand side?
GET THE FREE APP
Learn Playing. Play Learning
Send us a message