]> www.ginac.de Git - cln.git/blob - src/complex/transcendental/cl_C_log.cc
Initial revision
[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 "cl_complex.h"
8
9
10 // Implementation.
11
12 #include "cl_C.h"
13 #include "cl_real.h"
14 #include "cl_N.h"
15
16 const cl_N log (const cl_N& x)
17 {
18 // Methode:
19 // (complex (log (abs x)) (phase x))
20         var cl_R r = abs(x);
21         if (zerop(r)) // (abs x) = 0 -> Error
22                 { cl_error_division_by_0(); }
23         return complex(ln(r),phase(x));
24 }