Question: ```
echo 65.7 * 100 % 10 // 0

echo 65.6 * 100 % 10 // 9 <---

echo 6560 % 10       // 0

echo 65.5 * 100 % 10 // 0

```

Can someone please explain why?

**EDIT:**

for human or non-programmers, the result 9 is apprently wrong.

how can I prevent this `"error"` when programming?

Answer: 
Because `65.6` in floating point is actually an approximation of `65.6`. It is actually marginally less than `65.6`, i.e. `65.5999` or similar. 

Assuming my wild guess at the actual value is correct, you have `6559.9`, which is [stripped to `6599`](http://php.net/manual/en/language.operators.arithmetic.php) by the modulus operator, then divided by 10 for remainder 9.
Because:

```
<?php

echo (65.7 * 100 == 6570) ? "Equal" : "Not equal";  // Equal
echo (65.6 * 100 == 6560) ? "Equal" : "Not equal";  // NOT EQUAL !!
echo (65.5 * 100 == 6550) ? "Equal" : "Not equal";  // Equal

?>

```

65.6 \* 100 is **NOT** 6560. The [big red warning box here](http://php.net/manual/en/language.types.float.php) explains why.