source: trunk/libs/newlib/src/newlib/libm/complex/clog10.c @ 620

Last change on this file since 620 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/*
2FUNCTION
3        <<clog10>>, <<clog10f>>---complex base-10 logarithm
4
5INDEX
6        clog10
7INDEX
8        clog10f
9
10SYNOPSIS
11       #define _GNU_SOURCE
12       #include <complex.h>
13       double complex clog10(double complex <[z]>);
14       float complex clog10f(float complex <[z]>);
15
16
17DESCRIPTION
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
24RETURNS
25        The clog10 functions return the complex base-10 logarithm value.
26
27PORTABILITY
28        <<clog10>> and <<clog10f>> are GNU extensions.
29
30*/
31
32#include <complex.h>
33#include <math.h>
34
35double complex
36clog10(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.