that is very interesting: I also tried to force casting with `(int)((0.7 + 0.1)*(int)('10th'))` and it still prints `7`
– AlexandreDec 14 '16 at 12:42
1
What would you *expect* the "correct" result to be? Are you aware of floating point imprecision and that you cannot *expect* any particular result to begin with?
– decezeDec 14 '16 at 12:50
1
I don't see any resemblances with the duplicate. And this is not the first time. I guess the permissiveness of people with the high score will kill this site. It is really a pity.
– sevavietlDec 14 '16 at 12:52
@deceze, if you remove `(int)` casting you will get `8`, so `7` is really unexpected result.
– sevavietlDec 14 '16 at 12:54
3
@Rizier123 it's not duplicate. `http://php.net/manual/en/language.types.float.php` have "big red warning" with your example @ShiroiOkami
– YupikDec 14 '16 at 13:00
1
@sevavietl You will get a floating point number which is so close to 8 that it's displayed rounded up as 8, but when you floor the value (cast to int, same thing here) it's *actually* 7…
– decezeDec 14 '16 at 13:02