]> www.ginac.de Git - cln.git/blob - src/rational/misc/cl_RA_exptpos.cc
Use paths relative the `src' directory in the #include directives.
[cln.git] / src / rational / misc / cl_RA_exptpos.cc
1 // expt_pos().
2
3 // General includes.
4 #include "base/cl_sysdep.h"
5
6 // Specification.
7 #include "cln/rational.h"
8
9
10 // Implementation.
11
12 #include "rational/cl_RA.h"
13 #include "cln/integer.h"
14
15 namespace cln {
16
17 const cl_RA expt_pos (const cl_RA& x, uintL y)
18 {
19   // Methode:
20   // x Integer -> klar
21   // x Ratio a/b -> x^y = (a^y)/(b^y), gekürzt, mit b^y>=b>1.
22         if (integerp(x)) {
23                 DeclareType(cl_I,x);
24                 return expt_pos(x,y);
25         } else {
26                 DeclareType(cl_RT,x);
27                 var const cl_I& a = numerator(x);
28                 var const cl_I& b = denominator(x);
29                 return I_I_to_RT(expt_pos(a,y),expt_pos(b,y));
30         }
31 }
32
33 }  // namespace cln