7 #include "cl_integer.h"
14 const cl_I mod (const cl_I& x, const cl_I& y)
18 // (DIVIDE (abs x) (abs y)) -> q,r
19 // Falls x,y verschiedene Vorzeichen haben und r<>0, setze r:=r-abs(y).
20 // Falls x<0, setze r:=-r.
22 var cl_I abs_y = abs(y);
23 var cl_I r = cl_divide(abs(x),abs_y).remainder;
24 if (minusp(x) != minusp(y))
25 { if (zerop(r)) { return 0; }
28 if (minusp(x)) { return -r; } else { return r; }