]> www.ginac.de Git - cln.git/blob - src/complex/transcendental/cl_C_log.cc
Use paths relative the `src' directory in the #include directives.
[cln.git] / src / complex / transcendental / cl_C_log.cc
1 // log().
2
3 // General includes.
4 #include "base/cl_sysdep.h"
5
6 // Specification.
7 #include "cln/complex.h"
8
9
10 // Implementation.
11
12 #include "complex/cl_C.h"
13 #include "cln/real.h"
14 #include "base/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                 { throw division_by_0_exception(); }
25         return complex(ln(r),phase(x));
26 }
27
28 }  // namespace cln