]> www.ginac.de Git - cln.git/blob - src/real/elem/cl_R_mul.cc
* */*: Remove cl_boolean, cl_true, and cl_false in favor of built-in
[cln.git] / src / real / elem / cl_R_mul.cc
1 // binary operator *
2
3 // General includes.
4 #include "cl_sysdep.h"
5
6 // Specification.
7 #include "cln/real.h"
8
9
10 // Implementation.
11
12 #include "cl_R.h"
13 #include "cln/rational.h"
14 #include "cl_RA.h"
15 #include "cln/integer.h"
16 #include "cl_I.h"
17 #include "cl_F.h"
18 #include "cln/sfloat.h"
19 #include "cl_SF.h"
20 #include "cln/ffloat.h"
21 #include "cl_FF.h"
22 #include "cln/dfloat.h"
23 #include "cl_DF.h"
24 #include "cln/lfloat.h"
25 #include "cl_LF.h"
26 #include "cl_N.h"
27
28 namespace cln {
29
30 ALL_cl_LF_OPERATIONS_SAME_PRECISION()
31
32 const cl_R operator* (const cl_R& x, const cl_R& y)
33 {
34         if (eq(x,0)) { return 0; } // 0 * y = exakte 0
35         elif (eq(y,0)) { return 0; } // x * 0 = exakte 0
36         else
37 #define mul(a,b) a*b
38         realcase6(x
39         , /* I */       
40                         realcase6(y
41                         , /* I */       return mul(x,y);
42                         , /* RT */      return mul(x,y);
43                         , /* SF */      return mul(cl_I_to_SF(x),y);
44                         , /* FF */      return mul(cl_I_to_FF(x),y);
45                         , /* DF */      return mul(cl_I_to_DF(x),y);
46                         , /* LF */      return cl_LF_I_mul(y,x);
47                         );
48         , /* RT */      
49                         realcase6(y
50                         , /* I */       return mul(x,y);
51                         , /* RT */      return mul(x,y);
52                         , /* SF */      return mul(cl_RA_to_SF(x),y);
53                         , /* FF */      return mul(cl_RA_to_FF(x),y);
54                         , /* DF */      return mul(cl_RA_to_DF(x),y);
55                         , /* LF */      return cl_LF_RA_mul(y,x);
56                         );
57         , /* SF */      
58                         realcase6(y
59                         , /* I */       return mul(x,cl_I_to_SF(y));
60                         , /* RT */      return mul(x,cl_RA_to_SF(y));
61                         , /* SF */      return mul(x,y);
62                         , /* FF */      return cl_FF_to_SF(mul(cl_SF_to_FF(x),y));
63                         , /* DF */      return cl_DF_to_SF(mul(cl_SF_to_DF(x),y));
64                         , /* LF */      return cl_LF_to_SF(mul(cl_SF_to_LF(x,LFlen0(y)),y));
65                         );
66         , /* FF */      
67                         realcase6(y
68                         , /* I */       return mul(x,cl_I_to_FF(y));
69                         , /* RT */      return mul(x,cl_RA_to_FF(y));
70                         , /* SF */      return cl_FF_to_SF(mul(x,cl_SF_to_FF(y)));
71                         , /* FF */      return mul(x,y);
72                         , /* DF */      return cl_DF_to_FF(mul(cl_FF_to_DF(x),y));
73                         , /* LF */      return cl_LF_to_FF(mul(cl_FF_to_LF(x,LFlen0(y)),y));
74                         );
75         , /* DF */      
76                         realcase6(y
77                         , /* I */       return mul(x,cl_I_to_DF(y));
78                         , /* RT */      return mul(x,cl_RA_to_DF(y));
79                         , /* SF */      return cl_DF_to_SF(mul(x,cl_SF_to_DF(y)));
80                         , /* FF */      return cl_DF_to_FF(mul(x,cl_FF_to_DF(y)));
81                         , /* DF */      return mul(x,y);
82                         , /* LF */      return cl_LF_to_DF(mul(cl_DF_to_LF(x,LFlen0(y)),y));
83                         );
84         , /* LF */      
85                         realcase6(y
86                         , /* I */       return cl_LF_I_mul(x,y);
87                         , /* RT */      return cl_LF_RA_mul(x,y);
88                         , /* SF */      return cl_LF_to_SF(mul(x,cl_SF_to_LF(y,LFlen0(x))));
89                         , /* FF */      return cl_LF_to_FF(mul(x,cl_FF_to_LF(y,LFlen0(x))));
90                         , /* DF */      return cl_LF_to_DF(mul(x,cl_DF_to_LF(y,LFlen0(x))));
91                         , /* LF */      return mul(x,y);
92                         );
93         );
94 }
95
96 }  // namespace cln