program t34; { t34 -- the operators no other fixture uses. Every one of `div', `mod', `and', `or', unary `-' and a variable `*' is emitted by this compiler and has never been executed by any test: t08 was the only fixture that multiplied and it multiplied two CONSTANTS, which BinOpEmit folds without emitting anything. So `EmIDivAxCx', `EmXchgAxDx', `EmAndAxCx', `EmOrAxCx' and `EmNegAx' were all untested, and so is every instruction the Exec86 interpreter implements for them. The operands are deliberately VARIABLES, for the same reason: with two constants `p div q' folds at compile time and the runtime never runs. The four sign combinations of div and mod are the point. Pascal's `div' truncates toward zero and `mod' takes the sign of the dividend: a div b = truncation of a/b toward zero a mod b = a - b * (a div b) so -17 div 5 = -3 and -17 mod 5 = -2, where a floor-division machine would answer -4 and 1. ISO Modula-2, which Exec86 is written in, has Euclidean DIV/MOD (measured: (-7) MOD 2 = 1, 7 MOD (-2) = 1), so the interpreter has to convert; these eight lines are what says whether it converts the right way. `not' is absent here on purpose: it has its own fixture, t35_not, which is where the boolean/int split in TPSRC9 neglevel is checked. } var p : integer; q : integer; begin p := 17; q := 5; writeln (p * q); writeln (p + q); writeln (p - q); writeln (p div q); writeln (p mod q); writeln (-p); writeln ((p > q) and (q > p)); writeln ((p > q) or (q > p)); p := -17; q := 5; writeln (p div q); writeln (p mod q); writeln (-p); p := 17; q := -5; writeln (p div q); writeln (p mod q); p := -17; q := -5; writeln (p div q); writeln (p mod q) end.