From 0d5bbb03497fb236d7d90377834431974b0614da Mon Sep 17 00:00:00 2001 From: ru Date: Wed, 13 Jun 2001 15:16:30 +0000 Subject: Added skeleton (aligned with the POSIX.1-200x), mostly to fix the "-nostdinc WARNS=X" breakage caused by broken prototypes for cabs() and cabsl() in . Reimplemented cabs() and cabsl() using new complex numbers types and moved prototypes from to . --- lib/msun/src/math.h | 2 -- lib/msun/src/w_cabs.c | 19 ++++++++++--------- lib/msun/src/w_cabsf.c | 18 ++++++++++-------- 3 files changed, 20 insertions(+), 19 deletions(-) (limited to 'lib/msun') diff --git a/lib/msun/src/math.h b/lib/msun/src/math.h index e26e39f..e5a5e16 100644 --- a/lib/msun/src/math.h +++ b/lib/msun/src/math.h @@ -174,7 +174,6 @@ extern double scalbn __P((double, int)); /* * BSD math library entry points */ -extern double cabs(); extern double drem __P((double, double)); extern double expm1 __P((double)); extern double log1p __P((double)); @@ -257,7 +256,6 @@ extern float scalbnf __P((float, int)); /* * float versions of BSD math library entry points */ -extern float cabsf (); extern float dremf __P((float, float)); extern float expm1f __P((float)); extern float log1pf __P((float)); 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 +#ifndef lint +static const char rcsid[] = + "$FreeBSD$"; +#endif /* not lint */ -struct complex { - double x; - double y; -}; +#include +#include 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)); } diff --git a/lib/msun/src/w_cabsf.c b/lib/msun/src/w_cabsf.c index 6336d6d..e7bfe22 100644 --- a/lib/msun/src/w_cabsf.c +++ b/lib/msun/src/w_cabsf.c @@ -5,17 +5,19 @@ * Placed into the Public Domain, 1994. */ -#include "math.h" -#include "math_private.h" +#ifndef lint +static const char rcsid[] = + "$FreeBSD$"; +#endif /* not lint */ -struct complex { - float x; - float y; -}; +#include +#include +#include "math_private.h" float cabsf(z) - struct complex z; + float complex z; { - return hypotf(z.x, z.y); + + return hypotf(crealf(z), cimagf(z)); } -- cgit v1.1