Tim Kaulmann wrote:
Hello !
I found out that the result of 6 MOD -90 in my little Pascal Program on Windows is -84 and on Solaris is 6 (in my opinion the right one). Whats up there ? BTW : My Calculator HP48 says that -84 was right ??? A matter of definition ?
I've just discussed this issue with my friends in the Institute and it seems interesting...
In usual mathematical practice a mod b is a non-negative r less than b such that b|(a-r). Most compilers seem to have their own understanding of mod, a kind of extension to mod definition. It is sure we should have a = (a div b)*b + (a mod b).
BTW according to BP 7.0 6 mod -90 is 6.
Regards