I'm looking for an explanation of a very weird PHP behaviour. By accident, we found a case where PHP rounds down an integer.
So in the following examples:
floor(2.05 * 100) == 204
is true as well as (int)(2.05 * 100) === 204
.
Both cases seem to be incorrect as floor() or (int) should result in a number 205, not 204.
When multiplying the number by 1000 and divide by 10 the result is correct while using (int):
(int)((2.05 * 1000) / 10) === 205
, but still incorrect when using floor().
Can you please advise why that happened?
My PHP version is 7.3.8, but possibly it's the same on the older versions as well.
Many thanks!