[fpc-pascal] modulo of negative dividend

Adriaan van Os fpc at microbizz.nl
Sat Mar 13 18:32:20 CET 2010

Flávio Etrusco wrote:
> 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.

Not really <http://www2.gnu-pascal.de/crystal/gpc/en/mail7597.html>.


Adriaan van Os

More information about the fpc-pascal mailing list