Re: 6 MOD -90 Problem on Windows
Tim Kaulmann wrote:
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 ?
Actually, it's defined as an error when the right operand is <=0. So probably we should implement such a check in GPC (perhaps together with other kinds of range or overflow checking). If in your program the right operand is a variabls which might be negative, I suggest to use `Abs' (i.e., `a mod Abs (b)'), since a mod b = a mod (-b), according to "your" definition. Frank -- Frank Heckenbach, frank@g-n-u.de, http://fjf.gnu.de/ GPC To-Do list, latest features, fixed bugs: http://agnes.dida.physik.uni-essen.de/~gnu-pascal/todo.html
participants (1)
-
Frank Heckenbach