Because float
and real
represent real numbers that can always be separated without a remainder. Modulo definition:
a mod n = r
if a = n*q + r
, where a
, n
, q
and r
are integers , for the smallest possible absolute value of r
.
Take a look at http://en.wikipedia.org/wiki/Modulo_operation
For other, non-integer, but fixed point variables, a modulo definition can be found because the two values โโof a fixed point cannot always be separated without a remainder. However, usually you want to use modulo for integer arithmetic, otherwise you will get different results from the expected.
source share