[Gambas-user] Modulo operator returns wrong results

Benoît Minisini gambas at ...1...
Wed Sep 25 02:42:52 CEST 2013


Le 25/09/2013 01:23, Jesus a écrit :
> I've been racking my brain with a simple problem and I've discovered
> something weird with "Mod" operator, returning wrong results.
>
> For example, -3 Mod 800 gives -3, and it should be 797.
>
> It's only me or someone else has wrong results?
>

See
http://en.wikipedia.org/wiki/Modulo_operation#Common_pitfalls

-3 Mod 800 = -(3 Mod 800)

This is not the mathematical modulus operator.

-- 
Benoît Minisini




More information about the User mailing list