]> www.ginac.de Git - cln.git/blob - src/complex/algebraic/cl_C_signum.cc
Fix linking problems on some platforms caused by inline/non-inline versions
[cln.git] / src / complex / algebraic / cl_C_signum.cc
1 // signum().
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 #include "cl_inline.h"
16 #include "cl_C_abs_aux.cc"
17
18 namespace cln {
19
20 const cl_N CL_FLATTEN signum (const cl_N& x)
21 {
22 // Methode:
23 // x reell -> klar.
24 // x komplex -> falls (zerop x), x als Ergebnis, sonst (/ x (abs x)).
25         if (realp(x)) {
26                 DeclareType(cl_R,x);
27                 return signum(x);
28         } else {
29                 DeclareType(cl_C,x);
30                 if (zerop(x))
31                         return x;
32                 else
33                         return x / abs_inline(x);
34         }
35 }
36
37 }  // namespace cln