]> www.ginac.de Git - cln.git/blob - src/real/division/cl_R_fround22.cc
Use paths relative the `src' directory in the #include directives.
[cln.git] / src / real / division / cl_R_fround22.cc
1 // fround2().
2
3 // General includes.
4 #include "base/cl_sysdep.h"
5
6 // Specification.
7 #include "cln/real.h"
8
9
10 // Implementation.
11
12 #include "real/cl_R.h"
13 #include "real/division/cl_R_div_t.h"
14
15 namespace cln {
16
17 const cl_R_fdiv_t fround2 (const cl_R& x, const cl_R& y)
18 {
19 // Methode:
20 // x,y beide rational: round(x,y), Quotienten in Float umwandeln.
21 // Sonst: fround(x/y) -> q,r. Liefere die Werte q und x-y*q = y*r.
22         if (rationalp(x))
23                 if (rationalp(y)) {
24                         // beides rationale Zahlen
25                         DeclareType(cl_RA,x);
26                         DeclareType(cl_RA,y);
27                         var cl_R_div_t q_r = round2(x,y);
28                         var cl_I& q = q_r.quotient;
29                         var cl_R& r = q_r.remainder;
30                         return cl_R_fdiv_t(cl_float(q),r);
31                 }
32         var cl_R_fdiv_t q_r = fround2(x/y);
33         var cl_F& q = q_r.quotient;
34         var cl_R& r = q_r.remainder;
35         return cl_R_fdiv_t(q,y*r);
36 }
37
38 }  // namespace cln