7 #include "cln/integer.h"
16 const cl_I floor1 (const cl_I& x, const cl_I& y)
20 // (DIVIDE (abs x) (abs y)) -> q,r
21 // Falls x,y verschiedene Vorzeichen haben und r<>0,
22 // setze q:=q+1 und r:=r-abs(y).
23 // Falls x<0, setze r:=-r.
24 // Falls x,y verschiedene Vorzeichen haben, setze q:=-q.
26 var cl_I abs_y = abs(y);
27 var cl_I_div_t q_r = cl_divide(abs(x),abs_y);
28 var cl_I& q = q_r.quotient;
29 var cl_I& r = q_r.remainder;
30 if (minusp(x) != minusp(y)) {
31 if (!zerop(r)) { q = q + 1; }