]> www.ginac.de Git - cln.git/blob - src/complex/elem/cl_C_zerop.cc
b9344c8b00d3979c3af4aab36983c079292f6aa1
[cln.git] / src / complex / elem / cl_C_zerop.cc
1 // zerop().
2
3 // General includes.
4 #include "cl_sysdep.h"
5
6 // Specification.
7 #include "cln/complex.h"
8
9
10 // Implementation.
11
12 #include "cl_C.h"
13 #include "cln/real.h"
14
15 namespace cln {
16
17 bool zerop (const cl_N& x)
18 {
19         if (realp(x)) {
20                 DeclareType(cl_R,x);
21                 return zerop(x);
22         } else {
23                 DeclareType(cl_C,x);
24                 // x komplex, teste ob Real- und Imaginärteil beide = 0 sind.
25                 var const cl_R& a = realpart(x);
26                 var const cl_R& b = imagpart(x);
27                 if (zerop(a))
28                         if (zerop(b))
29                                 return true;
30                 return false;
31         }
32 }
33
34 }  // namespace cln