]> www.ginac.de Git - cln.git/blob - src/float/elem/cl_F_RA_div.cc
Fix integer input with leading zeros in power-of-two base.
[cln.git] / src / float / elem / cl_F_RA_div.cc
1 // binary operator /
2
3 // General includes.
4 #include "base/cl_sysdep.h"
5
6 // Specification.
7 #include "cln/float.h"
8
9
10 // Implementation.
11
12 #include "rational/cl_RA.h"
13 #include "cln/sfloat.h"
14 #include "cln/ffloat.h"
15 #include "cln/dfloat.h"
16 #include "cln/lfloat.h"
17 #include "float/cl_F.h"
18 #include "float/sfloat/cl_SF.h"
19 #include "float/ffloat/cl_FF.h"
20 #include "float/dfloat/cl_DF.h"
21 #include "float/lfloat/cl_LF.h"
22
23 namespace cln {
24
25 const cl_F operator/ (const cl_F& x, const cl_RA& y)
26 {
27         floatcase(x
28         , /* SF */      if (integerp(y)) {
29                                 DeclareType(cl_I,y);
30                                 return x / cl_I_to_SF(y);
31                         } else
32                                 return x / cl_RA_to_SF(y);
33         , /* FF */      if (integerp(y)) {
34                                 DeclareType(cl_I,y);
35                                 return x / cl_I_to_FF(y);
36                         } else
37                                 return x / cl_RA_to_FF(y);
38         , /* DF */      if (integerp(y)) {
39                                 DeclareType(cl_I,y);
40                                 return x / cl_I_to_DF(y);
41                         } else
42                                 return x / cl_RA_to_DF(y);
43         , /* LF */      if (integerp(y)) {
44                                 DeclareType(cl_I,y);
45                                 return cl_LF_I_div(x,y);
46                         } else
47                                 return cl_LF_RA_div(x,y);
48         );
49 }
50
51 }  // namespace cln