]> www.ginac.de Git - cln.git/blob - src/complex/transcendental/cl_C_log.cc
Extend the exponent range from 32 bits to 64 bits on selected platforms.
[cln.git] / src / complex / transcendental / cl_C_log.cc
1 // log().
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 #include "cl_N.h"
15
16 namespace cln {
17
18 const cl_N log (const cl_N& x)
19 {
20 // Methode:
21 // (complex (log (abs x)) (phase x))
22         var cl_R r = abs(x);
23         if (zerop(r)) // (abs x) = 0 -> Error
24                 { cl_error_division_by_0(); }
25         return complex(ln(r),phase(x));
26 }
27
28 }  // namespace cln