And we're going again. I will answer you because you still do not have an answer for PHP, and someone will answer before the question is closed as a duplicate.
You can not use type double
or equivalent when you need numerical precision. This type of data is made to process fast and not to be exact.
The ideal in these cases is to use integers and present as you wish, with the amount of houses you want. In other words, treat everything as small as possible, for example, cents, so you do not have to deal with decimals. You'll still have to know how to deal with the necessary rounding.
I doubt that's the case, but if you do not need calculations and just need to compare, treat everything as string . This rarely applies, but it is an option.
Or create or use a class for a decimal or monetary type. You have libraries ready but I do not like them, not even default .
There are several questions on the subject here:
Reading everything, following the link allows you to learn well why this happens and how to avoid in any situation in any language or software.
The problem is this, using the wrong data type will always have problems. Any attempt to get around some gambiarra will only create the illusion of solution.