[fpc-pascal] modulo of negative dividend

Flávio Etrusco flavio.etrusco at gmail.com
Sat Mar 13 18:04:20 CET 2010


2010/3/13 Martín Marqués <martin.marques at gmail.com>:
> I'm checking the mod binary operator, and I found out that if the
> dividend is negative, it gives a negative result. AFAIK, mod gives an
> integer between 0 and d-1, where d is the divisor.
>
> Isn't this the right behavior?
>
> --
> Martín Marqués

This is the mathematical definition of modulus, but all programming
languages implement the same behavior as the one of FPC.

Best regards,
Flávio



More information about the fpc-pascal mailing list