1 /* Copyright (c) 2016 Yaakov Selkowitz <yselkowi@redhat.com> */ 2 /* 3 FUNCTION 4 <<clog10>>, <<clog10f>>---complex base-10 logarithm 5 6 INDEX 7 clog10 8 INDEX 9 clog10f 10 11 SYNOPSIS 12 #define _DEFAULT_SOURCE 13 #include <complex.h> 14 double complex clog10(double complex <[z]>); 15 float complex clog10f(float complex <[z]>); 16 17 18 DESCRIPTION 19 These functions compute the complex base-10 logarithm of <[z]>. 20 <<clog10>> is equivalent to <<clog>>(<[z]>)/<<log>>(10). 21 22 <<clog10f>> is identical to <<clog10>>, except that it performs 23 its calculations on <<floats complex>>. 24 25 RETURNS 26 The clog10 functions return the complex base-10 logarithm value. 27 28 PORTABILITY 29 <<clog10>> and <<clog10f>> are GNU extensions. 30 31 */ 32 33 #define _DEFAULT_SOURCE 34 #include <complex.h> 35 #include <math.h> 36 37 #ifdef _HAVE_LONG_DOUBLE_MATH 38 39 long double complex clog10l(long double complex z)40clog10l(long double complex z) 41 { 42 long double complex w; 43 long double p, rr; 44 45 rr = cabsl(z); 46 p = log10l(rr); 47 rr = atan2l(cimagl(z), creall(z)) * _M_IVLN10L; 48 w = p + rr * (long double complex) I; 49 return w; 50 } 51 52 #endif 53