diff options
author | ru <ru@FreeBSD.org> | 2001-06-13 15:16:30 +0000 |
---|---|---|
committer | ru <ru@FreeBSD.org> | 2001-06-13 15:16:30 +0000 |
commit | 0d5bbb03497fb236d7d90377834431974b0614da (patch) | |
tree | 37b7552d4bd478688101be23177232d72f8186b9 /lib/msun/src/w_cabs.c | |
parent | 086630c576392797f494de067ba6ca5608875b1a (diff) | |
download | FreeBSD-src-0d5bbb03497fb236d7d90377834431974b0614da.zip FreeBSD-src-0d5bbb03497fb236d7d90377834431974b0614da.tar.gz |
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>.
Diffstat (limited to 'lib/msun/src/w_cabs.c')
-rw-r--r-- | lib/msun/src/w_cabs.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/lib/msun/src/w_cabs.c b/lib/msun/src/w_cabs.c index b140515..a33a41f 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)); } |