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