let k1 = 1;;
let rec f i k =
if (((i / k1) * k1 + (i mod k1)) <> i)
then (raise (Failure "violation of integer division axiom"))
else (if (i < 10) then (f (i + 1) k) else ()) in
f 0 1;;
Now, if I change the above only on line 3 changing k1 to k, then it works fine, no problem.
let k1 = 1;;
let rec f i k =
if (((i / k) * k + (i mod k)) <> i)
then (raise (Failure "violation of integer division axiom"))
else (if (i < 10) then (f (i + 1) k) else ()) in
f 0 1;;
No exception in either ocamlc or ocamlopt.
Using ocamlopt, it seems 1 mod 1 = 1. This is problematic.
Tao Stein / 石涛