]> www.ginac.de Git - cln.git/blob - src/float/lfloat/elem/cl_LF_RA_div.cc
0a51629e53b222e93abdb0cd64ae8ead5542d63a
[cln.git] / src / float / lfloat / elem / cl_LF_RA_div.cc
1 // cl_LF_RA_div().
2
3 // General includes.
4 #include "cl_sysdep.h"
5
6 // Specification.
7 #include "cl_LF.h"
8
9
10 // Implementation.
11
12 #include "cl_lfloat.h"
13 #include "cl_rational.h"
14 #include "cl_RA.h"
15
16 const cl_LF cl_LF_RA_div (const cl_LF& x, const cl_RA& y)
17 {
18 // Method:
19 // Write y = u/v. Return (x*v)/u.
20         if (integerp(y)) {
21                 DeclareType(cl_I,y);
22                 return cl_LF_I_div(x,y);
23         } else {
24                 DeclareType(cl_RT,y);
25                 var const cl_I& u = TheRatio(y)->numerator; // u /= 0
26                 var const cl_I& v = TheRatio(y)->denominator; // v /= 0
27                 return cl_LF_I_div(The(cl_LF)(cl_LF_I_mul(x,v)),u);
28         }
29 }