Last change
on this file since 444 was
444,
checked in by satin@…, 6 years ago
|
add newlib,libalmos-mkh, restructure shared_syscalls.h and mini-libc
|
File size:
1.2 KB
|
Line | |
---|
1 | /* $NetBSD: carg.c,v 1.1 2007/08/20 16:01:31 drochner Exp $ */ |
---|
2 | |
---|
3 | /* |
---|
4 | * Written by Matthias Drochner <drochner@NetBSD.org>. |
---|
5 | * Public domain. |
---|
6 | * |
---|
7 | * imported and modified include for newlib 2010/10/03 |
---|
8 | * Marco Atzeri <marco_atzeri@yahoo.it> |
---|
9 | */ |
---|
10 | |
---|
11 | /* |
---|
12 | FUNCTION |
---|
13 | <<carg>>, <<cargf>>---argument (phase angle) |
---|
14 | |
---|
15 | INDEX |
---|
16 | carg |
---|
17 | INDEX |
---|
18 | cargf |
---|
19 | |
---|
20 | SYNOPSIS |
---|
21 | #include <complex.h> |
---|
22 | double carg(double complex <[z]>); |
---|
23 | float cargf(float complex <[z]>); |
---|
24 | |
---|
25 | |
---|
26 | DESCRIPTION |
---|
27 | These functions compute the argument (also called phase angle) |
---|
28 | of <[z]>, with a branch cut along the negative real axis. |
---|
29 | |
---|
30 | <<cargf>> is identical to <<carg>>, except that it performs |
---|
31 | its calculations on <<floats complex>>. |
---|
32 | |
---|
33 | RETURNS |
---|
34 | @ifnottex |
---|
35 | The carg functions return the value of the argument in the |
---|
36 | interval [-pi, +pi] |
---|
37 | @end ifnottex |
---|
38 | @tex |
---|
39 | The carg functions return the value of the argument in the |
---|
40 | interval [$-\pi$, $+\pi$] |
---|
41 | @end tex |
---|
42 | |
---|
43 | PORTABILITY |
---|
44 | <<carg>> and <<cargf>> are ISO C99 |
---|
45 | |
---|
46 | QUICKREF |
---|
47 | <<carg>> and <<cargf>> are ISO C99 |
---|
48 | |
---|
49 | */ |
---|
50 | |
---|
51 | #include <complex.h> |
---|
52 | #include <math.h> |
---|
53 | |
---|
54 | double |
---|
55 | carg(double complex z) |
---|
56 | { |
---|
57 | |
---|
58 | return atan2( cimag(z) , creal(z) ); |
---|
59 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.