aboutsummaryrefslogtreecommitdiff
path: root/lib/msun/src/w_cabs.c
diff options
context:
space:
mode:
authorRuslan Ermilov <ru@FreeBSD.org>2001-06-13 15:16:30 +0000
committerRuslan Ermilov <ru@FreeBSD.org>2001-06-13 15:16:30 +0000
commitd28011e5568967c997ba3294d9e3ef72bd37aaa4 (patch)
tree37b7552d4bd478688101be23177232d72f8186b9 /lib/msun/src/w_cabs.c
parent1ca5464aae3bc6582710256b222609626e21dc5e (diff)
downloadsrc-d28011e5568967c997ba3294d9e3ef72bd37aaa4.tar.gz
src-d28011e5568967c997ba3294d9e3ef72bd37aaa4.zip
Added skeleton <complex.h> (aligned with the POSIX.1-200x), mostly
to fix the "-nostdinc WARNS=X" breakage caused by broken prototypes for cabs() and cabsl() in <math.h>. Reimplemented cabs() and cabsl() using new complex numbers types and moved prototypes from <math.h> to <complex.h>.
Notes
Notes: svn path=/head/; revision=78172
Diffstat (limited to 'lib/msun/src/w_cabs.c')
-rw-r--r--lib/msun/src/w_cabs.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/lib/msun/src/w_cabs.c b/lib/msun/src/w_cabs.c
index b140515973f9..a33a41faabdc 100644
--- a/lib/msun/src/w_cabs.c
+++ b/lib/msun/src/w_cabs.c
@@ -5,23 +5,24 @@
* Placed into the Public Domain, 1994.
*/
-#include <math.h>
+#ifndef lint
+static const char rcsid[] =
+ "$FreeBSD$";
+#endif /* not lint */
-struct complex {
- double x;
- double y;
-};
+#include <complex.h>
+#include <math.h>
double
cabs(z)
- struct complex z;
+ double complex z;
{
- return hypot(z.x, z.y);
+ return hypot(creal(z), cimag(z));
}
double
z_abs(z)
- struct complex *z;
+ double complex *z;
{
- return hypot(z->x, z->y);
+ return hypot(creal(*z), cimag(*z));
}