Conformance of the mod operator
Original Reporter info from Mantis: Adriaan van Os
-
Reporter name: Adriaan van Os
Original Reporter info from Mantis: Adriaan van Os
- Reporter name: Adriaan van Os
Description:
{$mode iso}
program modulo( Output);
var
i, j, m : integer;
begin
i := -10;
j := 100;
m := i mod j;
Writeln( ' m = ', i: 3, ' mod ', j: 3, ' = ', m: 3);
Writeln( '-10 mod 100 = ', -10 mod 100 :3);
end.
In ISO mode this should print 90 twice instead of -10. See section 6.7.2.2 Arithmetic operators of the ISO-7185:1990 standard:
: 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. :
Mantis conversion info:
- Mantis ID: 17685
- OS: Mac OS X
- OS Build: 10.5.4
- Build: svn trunk r16185
- Platform: Darwin i386
- Version: 2.5.1
- Fixed in version: 3.0.0
- Fixed in revision: 19558 (#6ec0f254)