]> www.ginac.de Git - cln.git/blob - src/real/division/cl_R_mod.cc
0ac034b7e2ffb2c1e22d97f457c5b1c233479249
[cln.git] / src / real / division / cl_R_mod.cc
1 // mod().
2
3 // General includes.
4 #include "cl_sysdep.h"
5
6 // Specification.
7 #include "cl_real.h"
8
9
10 // Implementation.
11
12 #include "cl_R.h"
13 #include "cl_integer.h"
14
15 const cl_R mod (const cl_R& x, const cl_R& y)
16 {
17 // Methode:
18 // Beides Integers -> mod(x,y).
19 // Sonst: floor2(x/y) -> (q,r). Liefere x-y*q=y*r.
20         if (integerp(x))
21                 if (integerp(y)) {
22                         DeclareType(cl_I,x);
23                         DeclareType(cl_I,y);
24                         return mod(x,y);
25                 }
26         return y * floor2(x/y).remainder;
27 }