Last change
on this file was
444,
checked in by satin@…, 6 years ago
|
add newlib,libalmos-mkh, restructure shared_syscalls.h and mini-libc
|
File size:
933 bytes
|
Line | |
---|
1 | /* |
---|
2 | FUNCTION |
---|
3 | <<clog10>>, <<clog10f>>---complex base-10 logarithm |
---|
4 | |
---|
5 | INDEX |
---|
6 | clog10 |
---|
7 | INDEX |
---|
8 | clog10f |
---|
9 | |
---|
10 | SYNOPSIS |
---|
11 | #define _GNU_SOURCE |
---|
12 | #include <complex.h> |
---|
13 | double complex clog10(double complex <[z]>); |
---|
14 | float complex clog10f(float complex <[z]>); |
---|
15 | |
---|
16 | |
---|
17 | DESCRIPTION |
---|
18 | These functions compute the complex base-10 logarithm of <[z]>. |
---|
19 | <<clog10>> is equivalent to <<clog>>(<[z]>)/<<log>>(10). |
---|
20 | |
---|
21 | <<clog10f>> is identical to <<clog10>>, except that it performs |
---|
22 | its calculations on <<floats complex>>. |
---|
23 | |
---|
24 | RETURNS |
---|
25 | The clog10 functions return the complex base-10 logarithm value. |
---|
26 | |
---|
27 | PORTABILITY |
---|
28 | <<clog10>> and <<clog10f>> are GNU extensions. |
---|
29 | |
---|
30 | */ |
---|
31 | |
---|
32 | #include <complex.h> |
---|
33 | #include <math.h> |
---|
34 | |
---|
35 | double complex |
---|
36 | clog10(double complex z) |
---|
37 | { |
---|
38 | double complex w; |
---|
39 | double p, rr; |
---|
40 | |
---|
41 | rr = cabs(z); |
---|
42 | p = log10(rr); |
---|
43 | rr = atan2(cimag(z), creal(z)) * M_IVLN10; |
---|
44 | w = p + rr * I; |
---|
45 | return w; |
---|
46 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.