Last change
on this file since 559 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: cabs.c,v 1.1 2007/08/20 16:01:30 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 | <<cabs>>, <<cabsf>>, <<cabsl>>---complex absolute-value |
---|
14 | |
---|
15 | INDEX |
---|
16 | cabs |
---|
17 | INDEX |
---|
18 | cabsf |
---|
19 | INDEX |
---|
20 | cabsl |
---|
21 | |
---|
22 | SYNOPSIS |
---|
23 | #include <complex.h> |
---|
24 | double cabs(double complex <[z]>); |
---|
25 | float cabsf(float complex <[z]>); |
---|
26 | long double cabsl(long double complex <[z]>); |
---|
27 | |
---|
28 | |
---|
29 | DESCRIPTION |
---|
30 | These functions compute compute the complex absolute value |
---|
31 | (also called norm, modulus, or magnitude) of <[z]>. |
---|
32 | |
---|
33 | <<cabsf>> is identical to <<cabs>>, except that it performs |
---|
34 | its calculations on <<float complex>>. |
---|
35 | |
---|
36 | <<cabsl>> is identical to <<cabs>>, except that it performs |
---|
37 | its calculations on <<long double complex>>. |
---|
38 | |
---|
39 | RETURNS |
---|
40 | The cabs* functions return the complex absolute value. |
---|
41 | |
---|
42 | PORTABILITY |
---|
43 | <<cabs>>, <<cabsf>> and <<cabsl>> are ISO C99 |
---|
44 | |
---|
45 | QUICKREF |
---|
46 | <<cabs>>, <<cabsf>> and <<cabsl>> are ISO C99 |
---|
47 | |
---|
48 | */ |
---|
49 | |
---|
50 | |
---|
51 | #include <complex.h> |
---|
52 | #include <math.h> |
---|
53 | |
---|
54 | double |
---|
55 | cabs(double complex z) |
---|
56 | { |
---|
57 | |
---|
58 | return hypot( creal(z), cimag(z) ); |
---|
59 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.