On 5 Apr 2000, at 16:50, Mariusz Zynel wrote:
Most compilers seem to have their own understanding of mod, a kind of extension to mod definition.
The Extended Pascal standard (ISO 10206) says:
"A term of the form i mod j shall be an error if j is zero or negative; otherwise, the value of i mod j shall be that value of (i-(k*j)) for integral k such that 0 <= i mod j < j."
So, at least for EP, the original expression (6 mod -90) should give an error.
It is sure we should have a = (a div b)*b + (a mod b).
Not so sure, at least for EP! The standard also has this note:
"Only for i >= 0 and j > 0 does the relation (i div j) * j + i mod j = i hold."
BTW according to BP 7.0 6 mod -90 is 6.
Then at least for BP and EP, we need different "mod" semantics.
-- Dave