[Oberon] Modulus on negative number
Peter Matthias
PeterMatthias at web.de
Thu Feb 16 00:00:10 CET 2017
Am 15.02.2017 um 04:21 schrieb Srinivas Nayak:
> Dear All,
>
> Recently I come across modulus on a negative number.
> Will it produce a negative number or positive?
> Someone says both are correct! http://stackoverflow.com/a/4403556
> Which one is mathematically correct?
> Surprisingly different languages calculate it differently even!
> What is Oberon's way?
The theory was already answered. In practice, all compiler
implementations I used (native X86, Shark, MIPS), give wrong result when
both, divident and divisor are negative. I fixed it just yesterday for
all non x86 versions.
Regards,
Peter
More information about the Oberon
mailing list