Why does MOD (11.2,2) give 1,2 and not 0?

1

I need to get the rest of a division in ORACLE and I'm using MOD that works fine with integers but when using decimal numbers gives problem. Ex: MOD (11,2) = 1 ok MOD (11.2,2) = 1.2 Wrong right in my understanding would be 0 because 11.2 / 2 = 5,6 exact

Any help will be welcome

Thank you

    
asked by anonymous 05.12.2017 / 18:07

1 answer

0

The result you expected MOD(11.2,2) = 0 is incorrect because the result of the division will always be an integer and the rest of the division may or may not be an integer logo the correct result is 1,2 because it divides by 10 by 2 which results in the integer 5.

If we were to follow its logic, any existing number would result in 0, since it always gives a 2 by dividing if a real number (type divide 3 mod 2, is given 1,5 and the remainder = 0 what's wrong).

    
05.12.2017 / 18:59