diff options
author | Martynas Venckus <martynas@cvs.openbsd.org> | 2008-06-21 08:26:20 +0000 |
---|---|---|
committer | Martynas Venckus <martynas@cvs.openbsd.org> | 2008-06-21 08:26:20 +0000 |
commit | da0db31a60ab89941238c857fbbe25284941857f (patch) | |
tree | e99f3a4def6f12c36c853509c8b60e0ab3999ee0 /lib/libm | |
parent | 0d378bf6f459984aa2f7ca84f810d5d98e8f8f15 (diff) |
cleaning up, no functional changes
- no support for National 32000, removing ns32000/national ifdefs maze
- remove tahoe defs
- ansify
looks fine to millert@; who also noticed rint removal
Diffstat (limited to 'lib/libm')
38 files changed, 211 insertions, 280 deletions
diff --git a/lib/libm/arch/vax/n_sincos.S b/lib/libm/arch/vax/n_sincos.S index c8ee411c8b6..a9f0bcc35b8 100644 --- a/lib/libm/arch/vax/n_sincos.S +++ b/lib/libm/arch/vax/n_sincos.S @@ -1,4 +1,4 @@ -/* $OpenBSD: n_sincos.S,v 1.3 2008/05/21 20:37:10 miod Exp $ */ +/* $OpenBSD: n_sincos.S,v 1.4 2008/06/21 08:26:19 martynas Exp $ */ /* $NetBSD: n_sincos.S,v 1.1 1995/10/10 23:40:28 ragge Exp $ */ /* * Copyright (c) 1985, 1993 @@ -42,8 +42,8 @@ * sin() observed maximum error = 0.814 ulps * cos() observed maximum error = 0.792 ulps * - * double sin(arg) - * double arg; + * double + * sin(double arg) * method: true range reduction to [-pi/4,pi/4], P. Tang & B. Corbett * S. McDonald, April 4, 1985 */ @@ -71,8 +71,8 @@ ENTRY(sin, R2|R3|R4|R5|R6|R7|R8|R9|R10|R11) 1: ret /* - * double cos(arg) - * double arg; + * double + * cos(double arg) * method: true range reduction to [-pi/4,pi/4], P. Tang & B. Corbett * S. McDonald, April 4, 1985 */ diff --git a/lib/libm/arch/vax/n_sqrt.S b/lib/libm/arch/vax/n_sqrt.S index a7e4beb32c5..8117544706e 100644 --- a/lib/libm/arch/vax/n_sqrt.S +++ b/lib/libm/arch/vax/n_sqrt.S @@ -1,4 +1,4 @@ -/* $OpenBSD: n_sqrt.S,v 1.3 2008/05/21 20:37:10 miod Exp $ */ +/* $OpenBSD: n_sqrt.S,v 1.4 2008/06/21 08:26:19 martynas Exp $ */ /* $NetBSD: n_sqrt.S,v 1.1 1995/10/10 23:40:29 ragge Exp $ */ /* * Copyright (c) 1985, 1993 @@ -35,8 +35,8 @@ #include <sys/errno.h> /* - * double sqrt(arg) revised August 15,1982 - * double arg; + * double + * sqrt(double arg) revised August 15,1982 * if(arg<0.0) { errno = EDOM; return(<a reserved operand>); } * if arg is a reserved operand it is returned as it is * W. Kahan's magic square root diff --git a/lib/libm/arch/vax/n_support.S b/lib/libm/arch/vax/n_support.S index 59a02975217..7b1ef8446e6 100644 --- a/lib/libm/arch/vax/n_support.S +++ b/lib/libm/arch/vax/n_support.S @@ -1,4 +1,4 @@ -/* $OpenBSD: n_support.S,v 1.10 2008/06/12 18:06:10 martynas Exp $ */ +/* $OpenBSD: n_support.S,v 1.11 2008/06/21 08:26:19 martynas Exp $ */ /* $NetBSD: n_support.S,v 1.1 1995/10/10 23:40:30 ragge Exp $ */ /* * Copyright (c) 1985, 1993 @@ -47,8 +47,8 @@ */ /* - * double copysign(x,y) - * double x,y; + * double + * copysign(double x, double y) */ ENTRY(copysign, R2) @@ -61,8 +61,8 @@ ENTRY(copysign, R2) Lz: ret /* - * double logb(x) - * double x; + * double + * logb(double x) */ ENTRY(logb, 0) @@ -78,8 +78,8 @@ Ln: movq 4(ap),r0 # r0:1 = x (zero or reserved op) 1: ret /* - * long finite(x) - * double x; + * long + * finite(double x) */ ENTRY(finite, 0) @@ -92,8 +92,8 @@ ENTRY(finite, 0) ret /* - * double scalbn(x,N) - * double x; int N; + * double + * scalbn(double x, int N) */ ENTRY(scalbn, R2|R3) @@ -211,8 +211,8 @@ Ret: ret /* - * int isinff(x) - * float x; + * int + * isinff(float x) */ ENTRY(isinff, 0) @@ -220,8 +220,8 @@ ENTRY(isinff, 0) ret /* - * int isnanf(x) - * float x; + * int + * isnanf(float x) */ ENTRY(isnanf, 0) diff --git a/lib/libm/arch/vax/n_tan.S b/lib/libm/arch/vax/n_tan.S index 4672a9ea768..0f499a943fc 100644 --- a/lib/libm/arch/vax/n_tan.S +++ b/lib/libm/arch/vax/n_tan.S @@ -1,4 +1,4 @@ -/* $OpenBSD: n_tan.S,v 1.3 2008/05/21 20:37:10 miod Exp $ */ +/* $OpenBSD: n_tan.S,v 1.4 2008/06/21 08:26:19 martynas Exp $ */ /* $NetBSD: n_tan.S,v 1.1 1995/10/10 23:40:31 ragge Exp $ */ /* * Copyright (c) 1985, 1993 @@ -40,8 +40,8 @@ * under 1,024,000 random arguments testing on [0,2*pi] * tan() observed maximum error = 2.15 ulps * - * double tan(arg) - * double arg; + * double + * tan(double arg) * method: true range reduction to [-pi/4,pi/4], P. Tang & B. Corbett * S. McDonald, April 4, 1985 */ diff --git a/lib/libm/noieee_src/mathimpl.h b/lib/libm/noieee_src/mathimpl.h index 0439bf710b6..ec856a8b43d 100644 --- a/lib/libm/noieee_src/mathimpl.h +++ b/lib/libm/noieee_src/mathimpl.h @@ -1,4 +1,4 @@ -/* $OpenBSD: mathimpl.h,v 1.7 2008/06/12 22:43:36 martynas Exp $ */ +/* $OpenBSD: mathimpl.h,v 1.8 2008/06/21 08:26:19 martynas Exp $ */ /* $NetBSD: mathimpl.h,v 1.1 1995/10/10 23:36:31 ragge Exp $ */ /* * Copyright (c) 1988, 1993 @@ -33,12 +33,12 @@ #include <sys/cdefs.h> -#if defined(__vax__)||defined(tahoe) +#if defined(__vax__) /* Deal with concatenation in cpp */ # define cat3(a,b,c) a ## b ## c -/* Deal with vax/tahoe byte order issues */ +/* Deal with vax byte order issues */ # ifdef __vax__ # define cat3t(a,b,c) cat3(a,b,c) # else @@ -52,7 +52,7 @@ * * Args are the name to define, the decimal floating point value, * four 16-bit chunks of the float value in hex - * (because the vax and tahoe differ in float format!), the power + * (because the vax differ in float format!), the power * of 2 of the hex-float exponent, and the hex-float mantissa. * Most of these arguments are not used at compile time; they are * used in a post-check to make sure the constants were compiled @@ -68,7 +68,7 @@ # define ic(name, value, bexp, xval) ; -#else /* vax or tahoe */ +#else /* defined(__vax__) */ /* Hooray, we have an IEEE machine */ # undef vccast @@ -77,7 +77,7 @@ # define ic(name, value, bexp, xval) \ const static double name = value; -#endif /* defined(__vax__)||defined(tahoe) */ +#endif /* defined(__vax__) */ /* diff --git a/lib/libm/noieee_src/n_acosh.c b/lib/libm/noieee_src/n_acosh.c index 07faacead2f..347cf1c8a0a 100644 --- a/lib/libm/noieee_src/n_acosh.c +++ b/lib/libm/noieee_src/n_acosh.c @@ -1,4 +1,4 @@ -/* $OpenBSD: n_acosh.c,v 1.6 2008/06/12 22:43:36 martynas Exp $ */ +/* $OpenBSD: n_acosh.c,v 1.7 2008/06/21 08:26:19 martynas Exp $ */ /* $NetBSD: n_acosh.c,v 1.1 1995/10/10 23:36:33 ragge Exp $ */ /* * Copyright (c) 1985, 1993 @@ -85,8 +85,7 @@ ic(ln2lo, 1.9082149292705877000E-10,-33, 1.A39EF35793C76) #endif double -acosh(x) - double x; +acosh(double x) { double t,big=1.E20; /* big+1==big */ diff --git a/lib/libm/noieee_src/n_asincos.c b/lib/libm/noieee_src/n_asincos.c index b8d6567f9cd..40cc86bcabb 100644 --- a/lib/libm/noieee_src/n_asincos.c +++ b/lib/libm/noieee_src/n_asincos.c @@ -1,4 +1,4 @@ -/* $OpenBSD: n_asincos.c,v 1.6 2008/06/12 22:43:36 martynas Exp $ */ +/* $OpenBSD: n_asincos.c,v 1.7 2008/06/21 08:26:19 martynas Exp $ */ /* $NetBSD: n_asincos.c,v 1.1 1995/10/10 23:36:34 ragge Exp $ */ /* * Copyright (c) 1985, 1993 @@ -89,8 +89,7 @@ static char sccsid[] = "@(#)asincos.c 8.1 (Berkeley) 6/4/93"; #include "mathimpl.h" double -asin(x) - double x; +asin(double x) { double s, t, one = 1.0; @@ -158,8 +157,7 @@ asin(x) */ double -acos(x) - double x; +acos(double x) { double t, one = 1.0; diff --git a/lib/libm/noieee_src/n_asinh.c b/lib/libm/noieee_src/n_asinh.c index 55e8bd9b53e..eb37461af3a 100644 --- a/lib/libm/noieee_src/n_asinh.c +++ b/lib/libm/noieee_src/n_asinh.c @@ -1,4 +1,4 @@ -/* $OpenBSD: n_asinh.c,v 1.6 2008/06/12 22:43:36 martynas Exp $ */ +/* $OpenBSD: n_asinh.c,v 1.7 2008/06/21 08:26:19 martynas Exp $ */ /* $NetBSD: n_asinh.c,v 1.1 1995/10/10 23:36:35 ragge Exp $ */ /* * Copyright (c) 1985, 1993 @@ -80,8 +80,8 @@ ic(ln2lo, 1.9082149292705877000E-10, -33, 1.A39EF35793C76) #define ln2lo vccast(ln2lo) #endif -double asinh(x) -double x; +double +asinh(double x) { double t,s; const static double small=1.0E-10, /* fl(1+small*small) == 1 */ diff --git a/lib/libm/noieee_src/n_atan.c b/lib/libm/noieee_src/n_atan.c index c0af9a97122..f2dd0a684bf 100644 --- a/lib/libm/noieee_src/n_atan.c +++ b/lib/libm/noieee_src/n_atan.c @@ -1,4 +1,4 @@ -/* $OpenBSD: n_atan.c,v 1.4 2008/06/12 22:43:36 martynas Exp $ */ +/* $OpenBSD: n_atan.c,v 1.5 2008/06/21 08:26:19 martynas Exp $ */ /* $NetBSD: n_atan.c,v 1.1 1995/10/10 23:36:36 ragge Exp $ */ /* * Copyright (c) 1985, 1993 @@ -79,8 +79,8 @@ static char sccsid[] = "@(#)atan.c 8.1 (Berkeley) 6/4/93"; #include "math.h" -double atan(x) -double x; +double +atan(double x) { double one=1.0; return(atan2(x,one)); diff --git a/lib/libm/noieee_src/n_atan2.c b/lib/libm/noieee_src/n_atan2.c index 3522f0865d3..35cc0d9e94f 100644 --- a/lib/libm/noieee_src/n_atan2.c +++ b/lib/libm/noieee_src/n_atan2.c @@ -1,4 +1,4 @@ -/* $OpenBSD: n_atan2.c,v 1.7 2008/06/12 22:43:36 martynas Exp $ */ +/* $OpenBSD: n_atan2.c,v 1.8 2008/06/21 08:26:19 martynas Exp $ */ /* $NetBSD: n_atan2.c,v 1.1 1995/10/10 23:36:37 ragge Exp $ */ /* * Copyright (c) 1985, 1993 @@ -171,8 +171,8 @@ ic(a11, 1.6438029044759730479E-2 , -6, 1.0D52174A1BB54) #define a12 vccast(a12) #endif -double atan2(y,x) -double y,x; +double +atan2(double y, double x) { static const double zero=0, one=1, small=1.0E-9, big=1.0E18; double t,z,signy,signx,hi,lo; @@ -268,13 +268,13 @@ begin: /* compute atan(t) for t in [-.4375, .4375] */ z = t*t; -#if defined(__vax__)||defined(tahoe) +#if defined(__vax__) z = t*(z*(a1+z*(a2+z*(a3+z*(a4+z*(a5+z*(a6+z*(a7+z*(a8+ z*(a9+z*(a10+z*(a11+z*a12)))))))))))); -#else /* defined(__vax__)||defined(tahoe) */ +#else /* defined(__vax__) */ z = t*(z*(a1+z*(a2+z*(a3+z*(a4+z*(a5+z*(a6+z*(a7+z*(a8+ z*(a9+z*(a10+z*a11))))))))))); -#endif /* defined(__vax__)||defined(tahoe) */ +#endif /* defined(__vax__) */ z = lo - z; z += t; z += hi; return(copysign((signx>zero)?z:PI-z,signy)); diff --git a/lib/libm/noieee_src/n_atanh.c b/lib/libm/noieee_src/n_atanh.c index ad4dc4a668d..1ab1ae77b45 100644 --- a/lib/libm/noieee_src/n_atanh.c +++ b/lib/libm/noieee_src/n_atanh.c @@ -1,4 +1,4 @@ -/* $OpenBSD: n_atanh.c,v 1.5 2008/06/12 22:43:36 martynas Exp $ */ +/* $OpenBSD: n_atanh.c,v 1.6 2008/06/21 08:26:19 martynas Exp $ */ /* $NetBSD: n_atanh.c,v 1.1 1995/10/10 23:36:38 ragge Exp $ */ /* * Copyright (c) 1985, 1993 @@ -63,21 +63,21 @@ static char sccsid[] = "@(#)atanh.c 8.1 (Berkeley) 6/4/93"; #include "math.h" #include "mathimpl.h" -#if defined(__vax__)||defined(tahoe) +#if defined(__vax__) #include <errno.h> -#endif /* defined(__vax__)||defined(tahoe) */ +#endif /* defined(__vax__) */ -double atanh(x) -double x; +double +atanh(double x) { double z; z = copysign(0.5,x); x = copysign(x,1.0); -#if defined(__vax__)||defined(tahoe) +#if defined(__vax__) if (x == 1.0) { return(copysign(1.0,z)*infnan(ERANGE)); /* sign(x)*INF */ } -#endif /* defined(__vax__)||defined(tahoe) */ +#endif /* defined(__vax__) */ x = x/(1.0-x); return( z*log1p(x+x) ); } diff --git a/lib/libm/noieee_src/n_cabs.c b/lib/libm/noieee_src/n_cabs.c index 5c15a847211..14709b7e2e8 100644 --- a/lib/libm/noieee_src/n_cabs.c +++ b/lib/libm/noieee_src/n_cabs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: n_cabs.c,v 1.7 2008/06/12 22:43:36 martynas Exp $ */ +/* $OpenBSD: n_cabs.c,v 1.8 2008/06/21 08:26:19 martynas Exp $ */ /* $NetBSD: n_cabs.c,v 1.1 1995/10/10 23:36:39 ragge Exp $ */ /* * Copyright (c) 1985, 1993 @@ -104,8 +104,7 @@ ic(sqrt2, 1.4142135623730951455E0 , 0, 1.6A09E667F3BCD) #endif double -hypot(x,y) -double x, y; +hypot(double x, double y) { static const double zero=0, one=1, small=1.0E-18; /* fl(1+small)==1 */ @@ -172,23 +171,21 @@ double x, y; struct complex { double x, y; }; double -cabs(z) -struct complex z; +cabs(struct complex z) { return hypot(z.x,z.y); } double -z_abs(z) -struct complex *z; +z_abs(struct complex *z) { return hypot(z->x,z->y); } /* A faster but less accurate version of cabs(x,y) */ #if 0 -double hypot(x,y) -double x, y; +double +hypot(double x, double y) { static const double zero=0, one=1; small=1.0E-18; /* fl(1+small)==1 */ diff --git a/lib/libm/noieee_src/n_cbrt.c b/lib/libm/noieee_src/n_cbrt.c index 03f23d4e657..164edc8f009 100644 --- a/lib/libm/noieee_src/n_cbrt.c +++ b/lib/libm/noieee_src/n_cbrt.c @@ -1,4 +1,4 @@ -/* $OpenBSD: n_cbrt.c,v 1.4 2008/06/12 22:43:36 martynas Exp $ */ +/* $OpenBSD: n_cbrt.c,v 1.5 2008/06/21 08:26:19 martynas Exp $ */ /* $NetBSD: n_cbrt.c,v 1.1 1995/10/10 23:36:40 ragge Exp $ */ /* * Copyright (c) 1985, 1993 @@ -51,7 +51,7 @@ static char sccsid[] = "@(#)cbrt.c 8.1 (Berkeley) 6/4/93"; * On a National machine, it has different ordering; therefore, this code * must be compiled with flag -DNATIONAL. */ -#if !defined(__vax__)&&!defined(tahoe) +#if !defined(__vax__) static const unsigned long B1 = 715094163, /* B1 = (682-0.03306235651)*2**20 */ @@ -63,19 +63,14 @@ static const double F= 45./28., G= 5./14.; -double cbrt(x) -double x; +double +cbrt(double x) { double r,s,t=0.0,w; unsigned long *px = (unsigned long *) &x, *pt = (unsigned long *) &t, mexp,sign; - -#ifdef national /* ordering of words in a floating points number */ - const int n0=1,n1=0; -#else /* national */ const int n0=0,n1=1; -#endif /* national */ mexp=px[n0]&0x7ff00000; if(mexp==0x7ff00000) return(x); /* cbrt(NaN,INF) is itself */ diff --git a/lib/libm/noieee_src/n_cosh.c b/lib/libm/noieee_src/n_cosh.c index a95dd73d88a..c42daa1ac33 100644 --- a/lib/libm/noieee_src/n_cosh.c +++ b/lib/libm/noieee_src/n_cosh.c @@ -1,4 +1,4 @@ -/* $OpenBSD: n_cosh.c,v 1.7 2008/06/12 22:43:36 martynas Exp $ */ +/* $OpenBSD: n_cosh.c,v 1.8 2008/06/21 08:26:19 martynas Exp $ */ /* $NetBSD: n_cosh.c,v 1.1 1995/10/10 23:36:42 ragge Exp $ */ /* * Copyright (c) 1985, 1993 @@ -97,14 +97,14 @@ ic(lnovfl, 7.0978271289338397310E2, 9, 1.62E42FEFA39EF) #define lnovfl vccast(lnovfl) #endif -#if defined(__vax__)||defined(tahoe) +#if defined(__vax__) static max = 126 ; -#else /* defined(__vax__)||defined(tahoe) */ +#else /* defined(__vax__) */ static max = 1023 ; -#endif /* defined(__vax__)||defined(tahoe) */ +#endif /* defined(__vax__) */ -double cosh(x) -double x; +double +cosh(double x) { static const double half=1.0/2.0, one=1.0, small=1.0E-18; /* fl(1+small)==1 */ diff --git a/lib/libm/noieee_src/n_erf.c b/lib/libm/noieee_src/n_erf.c index 3281985a8d9..886e6d07262 100644 --- a/lib/libm/noieee_src/n_erf.c +++ b/lib/libm/noieee_src/n_erf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: n_erf.c,v 1.5 2008/06/12 22:43:36 martynas Exp $ */ +/* $OpenBSD: n_erf.c,v 1.6 2008/06/21 08:26:19 martynas Exp $ */ /* $NetBSD: n_erf.c,v 1.1 1995/10/10 23:36:43 ragge Exp $ */ /*- * Copyright (c) 1992, 1993 @@ -144,7 +144,7 @@ static char sccsid[] = "@(#)erf.c 8.1 (Berkeley) 6/4/93"; * erfc/erf(NaN) is NaN */ -#if defined(__vax__) || defined(tahoe) +#if defined(__vax__) #define _IEEE 0 #define TRUNC(x) (double) (float) (x) #else @@ -153,13 +153,6 @@ static char sccsid[] = "@(#)erf.c 8.1 (Berkeley) 6/4/93"; #define infnan(x) 0.0 #endif -#ifdef _IEEE_LIBM -/* - * redefining "___function" to "function" in _IEEE_LIBM mode - */ -#include "ieee_libm.h" -#endif - static double tiny = 1e-300, half = 0.5, @@ -262,8 +255,8 @@ rd11 = -2.06466642800404317677021026611e+006, rd12 = 7.78293889471135381609201431274e+006, rd13 = -1.42821001129434127360582351685e+007; -double erf(x) - double x; +double +erf(double x) { double R, S, P, Q, ax, s, y, z, r; if(!finite(x)) { /* erf(nan)=nan */ @@ -320,8 +313,8 @@ double erf(x) return (z-one); } -double erfc(x) - double x; +double +erfc(double x) { double R, S, P, Q, s, ax, y, z, r; if (!finite(x)) { diff --git a/lib/libm/noieee_src/n_exp.c b/lib/libm/noieee_src/n_exp.c index 7c0db047b44..682522ad771 100644 --- a/lib/libm/noieee_src/n_exp.c +++ b/lib/libm/noieee_src/n_exp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: n_exp.c,v 1.7 2008/06/12 22:20:56 martynas Exp $ */ +/* $OpenBSD: n_exp.c,v 1.8 2008/06/21 08:26:19 martynas Exp $ */ /* * Copyright (c) 1985, 1993 * The Regents of the University of California. All rights reserved. @@ -112,7 +112,8 @@ ic(lnhuge, 7.1602103751842355450E2, 9, 1.6602B15B7ECF2) ic(lntiny,-7.5137154372698068983E2, 9, -1.77AF8EBEAE354) ic(invln2, 1.4426950408889633870E0, 0, 1.71547652B82FE) -double exp(double x) +double +exp(double x) { double z, hi, lo, c; int k; @@ -156,7 +157,8 @@ double exp(double x) /* returns exp(r = x + c) for |c| < |x| with no overlap. */ -double __exp__D(double x, double c) +double +__exp__D(double x, double c) { double z, hi, lo; int k; diff --git a/lib/libm/noieee_src/n_exp__E.c b/lib/libm/noieee_src/n_exp__E.c index b00d0b8e562..039427219ae 100644 --- a/lib/libm/noieee_src/n_exp__E.c +++ b/lib/libm/noieee_src/n_exp__E.c @@ -1,4 +1,4 @@ -/* $OpenBSD: n_exp__E.c,v 1.5 2008/06/12 22:43:36 martynas Exp $ */ +/* $OpenBSD: n_exp__E.c,v 1.6 2008/06/21 08:26:19 martynas Exp $ */ /* $NetBSD: n_exp__E.c,v 1.1 1995/10/10 23:36:45 ragge Exp $ */ /* * Copyright (c) 1985, 1993 @@ -106,19 +106,19 @@ ic(q2, 9.9176615021572857300E-4, -10, 1.03FC4CB8C98E8) #define q3 vccast(q3) #endif -double __exp__E(x,c) -double x,c; +double +__exp__E(double x, double c) { const static double zero=0.0, one=1.0, half=1.0/2.0, small=1.0E-19; double z,p,q,xp,xh,w; if(copysign(x,one)>small) { z = x*x ; p = z*( p1 +z* p2 ); -#if defined(__vax__)||defined(tahoe) +#if defined(__vax__) q = z*( q1 +z*( q2 +z* q3 )); -#else /* defined(__vax__)||defined(tahoe) */ +#else /* defined(__vax__) */ q = z*( q1 +z* q2 ); -#endif /* defined(__vax__)||defined(tahoe) */ +#endif /* defined(__vax__) */ xp= x*p ; xh= x*half ; w = xh-(q-xp) ; diff --git a/lib/libm/noieee_src/n_expm1.c b/lib/libm/noieee_src/n_expm1.c index 8dca54117b5..082aa608541 100644 --- a/lib/libm/noieee_src/n_expm1.c +++ b/lib/libm/noieee_src/n_expm1.c @@ -1,4 +1,4 @@ -/* $OpenBSD: n_expm1.c,v 1.7 2008/06/12 22:43:36 martynas Exp $ */ +/* $OpenBSD: n_expm1.c,v 1.8 2008/06/21 08:26:19 martynas Exp $ */ /* $NetBSD: n_expm1.c,v 1.1 1995/10/10 23:36:46 ragge Exp $ */ /* * Copyright (c) 1985, 1993 @@ -104,17 +104,17 @@ ic(invln2, 1.4426950408889633870E0, 0, 1.71547652B82FE) #define invln2 vccast(invln2) #endif -double expm1(x) -double x; +double +expm1(double x) { const static double one=1.0, half=1.0/2.0; double z,hi,lo,c; int k; -#if defined(__vax__)||defined(tahoe) +#if defined(__vax__) static prec=56; -#else /* defined(__vax__)||defined(tahoe) */ +#else /* defined(__vax__) */ static prec=53; -#endif /* defined(__vax__)||defined(tahoe) */ +#endif /* defined(__vax__) */ if (isnan(x)) return (x); diff --git a/lib/libm/noieee_src/n_floor.c b/lib/libm/noieee_src/n_floor.c index 731263e53aa..7eeda6ceaa0 100644 --- a/lib/libm/noieee_src/n_floor.c +++ b/lib/libm/noieee_src/n_floor.c @@ -1,4 +1,4 @@ -/* $OpenBSD: n_floor.c,v 1.6 2008/06/12 22:43:36 martynas Exp $ */ +/* $OpenBSD: n_floor.c,v 1.7 2008/06/21 08:26:19 martynas Exp $ */ /* $NetBSD: n_floor.c,v 1.1 1995/10/10 23:36:48 ragge Exp $ */ /* * Copyright (c) 1985, 1993 @@ -52,8 +52,7 @@ ic(L, 4503599627370496.0E0, 52, 1.0) /* 2**52 */ * customary for IEEE 754. No other signal can be emitted. */ double -floor(x) -double x; +floor(double x) { volatile double y; @@ -69,8 +68,7 @@ double x; } double -ceil(x) -double x; +ceil(double x) { volatile double y; @@ -85,7 +83,6 @@ double x; } } -#ifndef ns32000 /* rint() is in ./NATIONAL/support.s */ /* * algorithm for rint(x) in pseudo-pascal form ... * @@ -108,8 +105,7 @@ double x; * customary for IEEE 754. No other signal can be emitted. */ double -rint(x) -double x; +rint(double x) { double s; volatile double t; @@ -125,4 +121,3 @@ double x; t = x + s; /* x+s rounded to integer */ return (t - s); } -#endif /* not national */ diff --git a/lib/libm/noieee_src/n_fmod.c b/lib/libm/noieee_src/n_fmod.c index c7e5eb2b336..06bbc76cff3 100644 --- a/lib/libm/noieee_src/n_fmod.c +++ b/lib/libm/noieee_src/n_fmod.c @@ -1,4 +1,4 @@ -/* $OpenBSD: n_fmod.c,v 1.5 2008/06/12 22:43:36 martynas Exp $ */ +/* $OpenBSD: n_fmod.c,v 1.6 2008/06/21 08:26:19 martynas Exp $ */ /* $NetBSD: n_fmod.c,v 1.1 1995/10/10 23:36:49 ragge Exp $ */ /* * Copyright (c) 1989, 1993 @@ -64,8 +64,7 @@ static char sccsid[] = "@(#)fmod.c 8.1 (Berkeley) 6/4/93"; */ double -fmod(x,y) -double x,y; +fmod(double x, double y) { int ir,iy; double r,w; diff --git a/lib/libm/noieee_src/n_j0.c b/lib/libm/noieee_src/n_j0.c index 33b8e8f5040..8b46630b6ad 100644 --- a/lib/libm/noieee_src/n_j0.c +++ b/lib/libm/noieee_src/n_j0.c @@ -1,4 +1,4 @@ -/* $OpenBSD: n_j0.c,v 1.5 2008/06/12 22:43:36 martynas Exp $ */ +/* $OpenBSD: n_j0.c,v 1.6 2008/06/21 08:26:19 martynas Exp $ */ /* $NetBSD: n_j0.c,v 1.1 1995/10/10 23:36:52 ragge Exp $ */ /*- * Copyright (c) 1992, 1993 @@ -112,7 +112,7 @@ static char sccsid[] = "@(#)j0.c 8.2 (Berkeley) 11/30/93"; #include <float.h> #include <errno.h> -#if defined(__vax__) || defined(tahoe) +#if defined(__vax__) #define _IEEE 0 #else #define _IEEE 1 @@ -138,8 +138,7 @@ s03 = 5.135465502073181376284426245689510134134e-0007, s04 = 1.166140033337900097836930825478674320464e-0009; double -j0(x) - double x; +j0(double x) { double z, s,c,ss,cc,r,u,v; @@ -201,8 +200,7 @@ v03 = 2.591508518404578033173189144579208685163e-0007, v04 = 4.411103113326754838596529339004302243157e-0010; double -y0(x) - double x; +y0(double x) { double z, s, c, ss, cc, u, v; /* Y0(NaN) is NaN, y0(-inf) is Nan, y0(inf) is 0 */ @@ -332,8 +330,7 @@ static double ps2[5] = { 1.465761769482561965099880599279699314477e+0001, }; -static double pzero(x) - double x; +static double pzero(double x) { double *p,*q,z,r,s; if (x >= 8.00) {p = pr8; q= ps8;} @@ -424,8 +421,7 @@ static double qs2[6] = { -5.310954938826669402431816125780738924463e+0000, }; -static double qzero(x) - double x; +static double qzero(double x) { double *p,*q, s,r,z; if (x >= 8.00) {p = qr8; q= qs8;} diff --git a/lib/libm/noieee_src/n_j1.c b/lib/libm/noieee_src/n_j1.c index f399afe306b..cd147f548ec 100644 --- a/lib/libm/noieee_src/n_j1.c +++ b/lib/libm/noieee_src/n_j1.c @@ -1,4 +1,4 @@ -/* $OpenBSD: n_j1.c,v 1.4 2008/06/12 22:43:36 martynas Exp $ */ +/* $OpenBSD: n_j1.c,v 1.5 2008/06/21 08:26:19 martynas Exp $ */ /* $NetBSD: n_j1.c,v 1.1 1995/10/10 23:36:53 ragge Exp $ */ /*- * Copyright (c) 1992, 1993 @@ -112,7 +112,7 @@ static char sccsid[] = "@(#)j1.c 8.2 (Berkeley) 11/30/93"; #include <float.h> #include <errno.h> -#if defined(__vax__) || defined(tahoe) +#if defined(__vax__) #define _IEEE 0 #else #define _IEEE 1 @@ -141,8 +141,9 @@ s05 = 1.235422744261379203512624973117299248281e-0011; #define two_129 6.80564733841876926e+038 /* 2^129 */ #define two_m54 5.55111512312578270e-017 /* 2^-54 */ -double j1(x) - double x; + +double +j1(double x) { double z, s,c,ss,cc,r,u,v,y; y = fabs(x); @@ -167,11 +168,11 @@ double j1(x) * j1(x) = 1/sqrt(pi) * (P(1,x)*cc - Q(1,x)*ss) / sqrt(x) * y1(x) = 1/sqrt(pi) * (P(1,x)*ss + Q(1,x)*cc) / sqrt(x) */ -#if !defined(__vax__) && !defined(tahoe) +#if !defined(__vax__) if (y > two_129) /* x > 2^129 */ z = (invsqrtpi*cc)/sqrt(y); else -#endif /* defined(__vax__) || defined(tahoe) */ +#endif /* !defined(__vax__) */ { u = pone(y); v = qone(y); z = invsqrtpi*(u*cc-v*ss)/sqrt(y); @@ -204,8 +205,8 @@ static double v0[5] = { 1.665592462079920695971450872592458916421e-0011, }; -double y1(x) - double x; +double +y1(double x) { double z, s, c, ss, cc, u, v; /* if Y1(NaN) is NaN, Y1(-inf) is NaN, Y1(inf) is 0 */ @@ -337,8 +338,7 @@ static double ps2[5] = { 8.364638933716182492500902115164881195742e+0000, }; -static double pone(x) - double x; +static double pone(double x) { double *p,*q,z,r,s; if (x >= 8.0) {p = pr8; q= ps8;} @@ -430,8 +430,7 @@ static double qs2[6] = { -4.959498988226281813825263003231704397158e+0000, }; -static double qone(x) - double x; +static double qone(double x) { double *p,*q, s,r,z; if (x >= 8.0) {p = qr8; q= qs8;} diff --git a/lib/libm/noieee_src/n_jn.c b/lib/libm/noieee_src/n_jn.c index b1ba14cc364..f6458dc71b4 100644 --- a/lib/libm/noieee_src/n_jn.c +++ b/lib/libm/noieee_src/n_jn.c @@ -1,4 +1,4 @@ -/* $OpenBSD: n_jn.c,v 1.4 2008/06/12 22:43:36 martynas Exp $ */ +/* $OpenBSD: n_jn.c,v 1.5 2008/06/21 08:26:19 martynas Exp $ */ /* $NetBSD: n_jn.c,v 1.1 1995/10/10 23:36:54 ragge Exp $ */ /*- * Copyright (c) 1992, 1993 @@ -93,7 +93,7 @@ static char sccsid[] = "@(#)jn.c 8.2 (Berkeley) 11/30/93"; #include <float.h> #include <errno.h> -#if defined(__vax__) || defined(tahoe) +#if defined(__vax__) #define _IEEE 0 #else #define _IEEE 1 @@ -106,8 +106,8 @@ two = 2.0, zero = 0.0, one = 1.0; -double jn(n,x) - int n; double x; +double +jn(int n, double x) { int i, sgn; double a, b, temp; @@ -236,11 +236,11 @@ double jn(n,x) b = ((i+i)/x)*b - a; a = temp; /* scale b to avoid spurious overflow */ -# if defined(__vax__) || defined(tahoe) +# if defined(__vax__) # define BMAX 1e13 # else # define BMAX 1e100 -# endif /* defined(__vax__) || defined(tahoe) */ +# endif /* defined(__vax__) */ if (b > BMAX) { a /= b; t /= b; @@ -252,8 +252,9 @@ double jn(n,x) } return ((sgn == 1) ? -b : b); } -double yn(n,x) - int n; double x; + +double +yn(int n, double x) { int i, sign; double a, b, temp; diff --git a/lib/libm/noieee_src/n_lgamma.c b/lib/libm/noieee_src/n_lgamma.c index b824b196cef..06224770f41 100644 --- a/lib/libm/noieee_src/n_lgamma.c +++ b/lib/libm/noieee_src/n_lgamma.c @@ -1,4 +1,4 @@ -/* $OpenBSD: n_lgamma.c,v 1.5 2008/06/16 21:10:30 martynas Exp $ */ +/* $OpenBSD: n_lgamma.c,v 1.6 2008/06/21 08:26:19 martynas Exp $ */ /*- * Copyright (c) 1992, 1993 * The Regents of the University of California. All rights reserved. @@ -66,7 +66,7 @@ static char sccsid[] = "@(#)lgamma.c 8.2 (Berkeley) 11/30/93"; * non-positive integer returns +Inf. * NaN returns NaN */ -#if defined(__vax__) || defined(tahoe) +#if defined(__vax__) #define _IEEE 0 /* double and float have same size exponent field */ #define TRUNC(x) x = (double) (float) (x) diff --git a/lib/libm/noieee_src/n_log.c b/lib/libm/noieee_src/n_log.c index 01abe38cc42..b7cf17753cf 100644 --- a/lib/libm/noieee_src/n_log.c +++ b/lib/libm/noieee_src/n_log.c @@ -1,4 +1,4 @@ -/* $OpenBSD: n_log.c,v 1.5 2008/06/16 21:10:30 martynas Exp $ */ +/* $OpenBSD: n_log.c,v 1.6 2008/06/21 08:26:19 martynas Exp $ */ /* * Copyright (c) 1992, 1993 * The Regents of the University of California. All rights reserved. @@ -72,7 +72,7 @@ static char sccsid[] = "@(#)log.c 8.2 (Berkeley) 11/30/93"; * +Inf return +Inf */ -#if defined(__vax__) || defined(tahoe) +#if defined(__vax__) #define _IEEE 0 #define TRUNC(x) x = (double) (float) (x) #else diff --git a/lib/libm/noieee_src/n_log10.c b/lib/libm/noieee_src/n_log10.c index 111704542c7..e1c0e970bbc 100644 --- a/lib/libm/noieee_src/n_log10.c +++ b/lib/libm/noieee_src/n_log10.c @@ -1,4 +1,4 @@ -/* $OpenBSD: n_log10.c,v 1.5 2008/06/12 22:43:36 martynas Exp $ */ +/* $OpenBSD: n_log10.c,v 1.6 2008/06/21 08:26:19 martynas Exp $ */ /* $NetBSD: n_log10.c,v 1.1 1995/10/10 23:36:58 ragge Exp $ */ /* * Copyright (c) 1985, 1993 @@ -82,13 +82,12 @@ ic(ivln10, 4.3429448190325181667E-1, -2, 1.BCB7B1526E50E) #define ln10hi vccast(ln10hi) #endif - -double log10(x) -double x; +double +log10(double x) { -#if defined(__vax__)||defined(tahoe) +#if defined(__vax__) return(log(x)/ln10hi); -#else /* defined(__vax__)||defined(tahoe) */ +#else /* defined(__vax__) */ return(ivln10*log(x)); -#endif /* defined(__vax__)||defined(tahoe) */ +#endif /* defined(__vax__) */ } diff --git a/lib/libm/noieee_src/n_log1p.c b/lib/libm/noieee_src/n_log1p.c index dd60a2dd5ac..efcca325393 100644 --- a/lib/libm/noieee_src/n_log1p.c +++ b/lib/libm/noieee_src/n_log1p.c @@ -1,4 +1,4 @@ -/* $OpenBSD: n_log1p.c,v 1.7 2008/06/12 22:43:36 martynas Exp $ */ +/* $OpenBSD: n_log1p.c,v 1.8 2008/06/21 08:26:19 martynas Exp $ */ /* $NetBSD: n_log1p.c,v 1.1 1995/10/10 23:37:00 ragge Exp $ */ /* * Copyright (c) 1985, 1993 @@ -110,8 +110,8 @@ ic(sqrt2, 1.4142135623730951455E0, 0, 1.6A09E667F3BCD) #define sqrt2 vccast(sqrt2) #endif -double log1p(x) -double x; +double +log1p(double x) { const static double zero=0.0, negone= -1.0, one=1.0, half=1.0/2.0, small=1.0E-20; /* 1+small == 1 */ @@ -143,18 +143,18 @@ double x; /* end of if (x > negone) */ else { -#if defined(__vax__)||defined(tahoe) +#if defined(__vax__) if ( x == negone ) return (infnan(-ERANGE)); /* -INF */ else return (infnan(EDOM)); /* NaN */ -#else /* defined(__vax__)||defined(tahoe) */ +#else /* defined(__vax__) */ /* x = -1, return -INF with signal */ if ( x == negone ) return( negone/zero ); /* negative argument for log, return NaN with signal */ else return ( zero / zero ); -#endif /* defined(__vax__)||defined(tahoe) */ +#endif /* defined(__vax__) */ } } /* end of if (finite(x)) */ diff --git a/lib/libm/noieee_src/n_log__L.c b/lib/libm/noieee_src/n_log__L.c index 02b13b1e10e..efd7adac9dc 100644 --- a/lib/libm/noieee_src/n_log__L.c +++ b/lib/libm/noieee_src/n_log__L.c @@ -1,4 +1,4 @@ -/* $OpenBSD: n_log__L.c,v 1.5 2008/06/12 22:43:36 martynas Exp $ */ +/* $OpenBSD: n_log__L.c,v 1.6 2008/06/21 08:26:19 martynas Exp $ */ /* $NetBSD: n_log__L.c,v 1.1 1995/10/10 23:37:01 ragge Exp $ */ /* * Copyright (c) 1985, 1993 @@ -98,12 +98,12 @@ ic(L7, 1.4795612545334174692E-1, -3, 1.2F039F0085122) #define L8 vccast(L8) #endif -double __log__L(z) -double z; +double +__log__L(double z) { -#if defined(__vax__)||defined(tahoe) +#if defined(__vax__) return(z*(L1+z*(L2+z*(L3+z*(L4+z*(L5+z*(L6+z*(L7+z*L8)))))))); -#else /* defined(__vax__)||defined(tahoe) */ +#else /* defined(__vax__) */ return(z*(L1+z*(L2+z*(L3+z*(L4+z*(L5+z*(L6+z*L7))))))); -#endif /* defined(__vax__)||defined(tahoe) */ +#endif /* defined(__vax__) */ } diff --git a/lib/libm/noieee_src/n_pow.c b/lib/libm/noieee_src/n_pow.c index 3043740e511..9c44bfe2728 100644 --- a/lib/libm/noieee_src/n_pow.c +++ b/lib/libm/noieee_src/n_pow.c @@ -1,4 +1,4 @@ -/* $OpenBSD: n_pow.c,v 1.8 2008/06/12 22:43:36 martynas Exp $ */ +/* $OpenBSD: n_pow.c,v 1.9 2008/06/21 08:26:19 martynas Exp $ */ /* $NetBSD: n_pow.c,v 1.1 1995/10/10 23:37:02 ragge Exp $ */ /* * Copyright (c) 1985, 1993 @@ -107,7 +107,7 @@ static char sccsid[] = "@(#)pow.c 8.1 (Berkeley) 6/4/93"; #include "mathimpl.h" -#if (defined(__vax__) || defined(tahoe)) +#if defined(__vax__) #define TRUNC(x) x = (double) (float) x #define _IEEE 0 #else @@ -115,14 +115,14 @@ static char sccsid[] = "@(#)pow.c 8.1 (Berkeley) 6/4/93"; #define endian (((*(int *) &one)) ? 1 : 0) #define TRUNC(x) *(((int *) &x)+endian) &= 0xf8000000 #define infnan(x) 0.0 -#endif /* vax or tahoe */ +#endif /* defined(__vax__) */ const static double zero=0.0, one=1.0, two=2.0, negone= -1.0; static double pow_P(double, double); -double pow(x,y) -double x,y; +double +pow(double x, double y) { double t; if (y==zero) diff --git a/lib/libm/noieee_src/n_sincos.c b/lib/libm/noieee_src/n_sincos.c index 6bf91bef357..8cd26b5139f 100644 --- a/lib/libm/noieee_src/n_sincos.c +++ b/lib/libm/noieee_src/n_sincos.c @@ -1,4 +1,4 @@ -/* $OpenBSD: n_sincos.c,v 1.4 2008/06/12 22:43:36 martynas Exp $ */ +/* $OpenBSD: n_sincos.c,v 1.5 2008/06/21 08:26:19 martynas Exp $ */ /* $NetBSD: n_sincos.c,v 1.1 1995/10/10 23:37:04 ragge Exp $ */ /* * Copyright (c) 1987, 1993 @@ -37,8 +37,7 @@ static char sccsid[] = "@(#)sincos.c 8.1 (Berkeley) 6/4/93"; #include "mathimpl.h" double -sin(x) -double x; +sin(double x) { double a,c,z; @@ -67,8 +66,7 @@ double x; } double -cos(x) -double x; +cos(double x) { double a,c,z,s = 1.0; diff --git a/lib/libm/noieee_src/n_sinh.c b/lib/libm/noieee_src/n_sinh.c index 3747477922e..ade1f633e39 100644 --- a/lib/libm/noieee_src/n_sinh.c +++ b/lib/libm/noieee_src/n_sinh.c @@ -1,4 +1,4 @@ -/* $OpenBSD: n_sinh.c,v 1.7 2008/06/12 22:43:36 martynas Exp $ */ +/* $OpenBSD: n_sinh.c,v 1.8 2008/06/21 08:26:19 martynas Exp $ */ /* $NetBSD: n_sinh.c,v 1.1 1995/10/10 23:37:05 ragge Exp $ */ /* * Copyright (c) 1985, 1993 @@ -90,15 +90,15 @@ ic(lnovfl, 7.0978271289338397310E2, 9, 1.62E42FEFA39EF) #define lnovfl vccast(lnovfl) #endif -#if defined(__vax__)||defined(tahoe) +#if defined(__vax__) static max = 126 ; -#else /* defined(__vax__)||defined(tahoe) */ +#else /* defined(__vax__) */ static max = 1023 ; -#endif /* defined(__vax__)||defined(tahoe) */ +#endif /* defined(__vax__) */ -double sinh(x) -double x; +double +sinh(double x) { static const double one=1.0, half=1.0/2.0 ; double t, sign; diff --git a/lib/libm/noieee_src/n_support.c b/lib/libm/noieee_src/n_support.c index 6093b0080b1..2c41c767f0a 100644 --- a/lib/libm/noieee_src/n_support.c +++ b/lib/libm/noieee_src/n_support.c @@ -1,4 +1,4 @@ -/* $OpenBSD: n_support.c,v 1.9 2008/06/16 21:10:30 martynas Exp $ */ +/* $OpenBSD: n_support.c,v 1.10 2008/06/21 08:26:19 martynas Exp $ */ /* $NetBSD: n_support.c,v 1.1 1995/10/10 23:37:06 ragge Exp $ */ /* * Copyright (c) 1985, 1993 @@ -74,16 +74,16 @@ static char sccsid[] = "@(#)support.c 8.1 (Berkeley) 6/4/93"; #include "math.h" #include "mathimpl.h" -#if defined(__vax__)||defined(tahoe) /* VAX D format */ +#if defined(__vax__) /* VAX D format */ #include <errno.h> static const unsigned short msign=0x7fff, mexp =0x7f80 ; static const short prep1=57, gap=7, bias=129 ; static const double novf=1.7E38, nunf=3.0E-39; -#else /* defined(__vax__)||defined(tahoe) */ +#else /* defined(__vax__) */ static const unsigned short msign=0x7fff, mexp =0x7ff0 ; static const short prep1=54, gap=4, bias=1023 ; static const double novf=1.7E308, nunf=3.0E-308; -#endif /* defined(__vax__)||defined(tahoe) */ +#endif /* defined(__vax__) */ static const double zero = 0.0; @@ -91,28 +91,23 @@ double scalbn(double x, int N) { int k; - -#ifdef national - unsigned short *px=(unsigned short *) &x + 3; -#else /* national */ unsigned short *px=(unsigned short *) &x; -#endif /* national */ if( x == zero ) return(x); -#if defined(__vax__)||defined(tahoe) +#if defined(__vax__) if( (k= *px & mexp ) != ~msign ) { if (N < -260) return(nunf*nunf); else if (N > 260) { return(copysign(infnan(ERANGE),x)); } -#else /* defined(__vax__)||defined(tahoe) */ +#else /* defined(__vax__) */ if( (k= *px & mexp ) != mexp ) { if( N<-2100) return(nunf*nunf); else if(N>2100) return(novf+novf); if( k == 0 ) { x *= scalbn(1.0,(int)prep1); N -= prep1; return(scalbn(x,N));} -#endif /* defined(__vax__)||defined(tahoe) */ +#endif /* defined(__vax__) */ if((k = (k>>gap)+ N) > 0 ) if( k < (mexp>>gap) ) *px = (*px&~mexp) | (k<<gap); @@ -131,17 +126,12 @@ scalbn(double x, int N) double copysign(double x, double y) { -#ifdef national - unsigned short *px=(unsigned short *) &x+3, - *py=(unsigned short *) &y+3; -#else /* national */ unsigned short *px=(unsigned short *) &x, *py=(unsigned short *) &y; -#endif /* national */ -#if defined(__vax__)||defined(tahoe) +#if defined(__vax__) if ( (*px & mexp) == 0 ) return(x); -#endif /* defined(__vax__)||defined(tahoe) */ +#endif /* defined(__vax__) */ *px = ( *px & msign ) | ( *py & ~msign ); return(x); @@ -175,15 +165,11 @@ double logb(double x) { -#ifdef national - short *px=(short *) &x+3, k; -#else /* national */ short *px=(short *) &x, k; -#endif /* national */ -#if defined(__vax__)||defined(tahoe) +#if defined(__vax__) return (int)(((*px&mexp)>>gap)-bias); -#else /* defined(__vax__)||defined(tahoe) */ +#else /* defined(__vax__) */ if( (k= *px & mexp ) != mexp ) if ( k != 0 ) return ( (k>>gap) - bias ); @@ -195,21 +181,17 @@ logb(double x) return(x); else {*px &= msign; return(x);} -#endif /* defined(__vax__)||defined(tahoe) */ +#endif /* defined(__vax__) */ } int finite(double x) { -#if defined(__vax__)||defined(tahoe) +#if defined(__vax__) return(1); -#else /* defined(__vax__)||defined(tahoe) */ -#ifdef national - return( (*((short *) &x+3 ) & mexp ) != mexp ); -#else /* national */ +#else /* defined(__vax__) */ return( (*((short *) &x ) & mexp ) != mexp ); -#endif /* national */ -#endif /* defined(__vax__)||defined(tahoe) */ +#endif /* defined(__vax__) */ } double @@ -218,41 +200,33 @@ remainder(double x, double p) short sign; double hp, dp, tmp; unsigned short k; -#ifdef national - unsigned short - *px=(unsigned short *) &x +3, - *pp=(unsigned short *) &p +3, - *pd=(unsigned short *) &dp +3, - *pt=(unsigned short *) &tmp+3; -#else /* national */ unsigned short *px=(unsigned short *) &x , *pp=(unsigned short *) &p , *pd=(unsigned short *) &dp , *pt=(unsigned short *) &tmp; -#endif /* national */ *pp &= msign ; -#if defined(__vax__)||defined(tahoe) +#if defined(__vax__) if( ( *px & mexp ) == ~msign ) /* is x a reserved operand? */ -#else /* defined(__vax__)||defined(tahoe) */ +#else /* defined(__vax__) */ if( ( *px & mexp ) == mexp ) -#endif /* defined(__vax__)||defined(tahoe) */ +#endif /* defined(__vax__) */ return (x-p)-(x-p); /* create nan if x is inf */ if (p == zero) { -#if defined(__vax__)||defined(tahoe) +#if defined(__vax__) return(infnan(EDOM)); -#else /* defined(__vax__)||defined(tahoe) */ +#else /* defined(__vax__) */ return zero/zero; -#endif /* defined(__vax__)||defined(tahoe) */ +#endif /* defined(__vax__) */ } -#if defined(__vax__)||defined(tahoe) +#if defined(__vax__) if( ( *pp & mexp ) == ~msign ) /* is p a reserved operand? */ -#else /* defined(__vax__)||defined(tahoe) */ +#else /* defined(__vax__) */ if( ( *pp & mexp ) == mexp ) -#endif /* defined(__vax__)||defined(tahoe) */ +#endif /* defined(__vax__) */ { if (p != p) return p; else return x;} else if ( ((*pp & mexp)>>gap) <= 1 ) @@ -272,20 +246,20 @@ remainder(double x, double p) tmp = dp ; *pt += k ; -#if defined(__vax__)||defined(tahoe) +#if defined(__vax__) if( x < tmp ) *pt -= 128 ; -#else /* defined(__vax__)||defined(tahoe) */ +#else /* defined(__vax__) */ if( x < tmp ) *pt -= 16 ; -#endif /* defined(__vax__)||defined(tahoe) */ +#endif /* defined(__vax__) */ x -= tmp ; } if ( x > hp ) { x -= p ; if ( x >= hp ) x -= p ; } -#if defined(__vax__)||defined(tahoe) +#if defined(__vax__) if (x) -#endif /* defined(__vax__)||defined(tahoe) */ +#endif /* defined(__vax__) */ *px ^= sign; return( x); @@ -306,22 +280,22 @@ sqrt(double x) double q, s, b, r; double t; int m, n, i; -#if defined(__vax__)||defined(tahoe) +#if defined(__vax__) int k=54; -#else /* defined(__vax__)||defined(tahoe) */ +#else /* defined(__vax__) */ int k=51; -#endif /* defined(__vax__)||defined(tahoe) */ +#endif /* defined(__vax__) */ /* sqrt(NaN) is NaN, sqrt(+-0) = +-0 */ if(x!=x||x==zero) return(x); /* sqrt(negative) is invalid */ if(x<zero) { -#if defined(__vax__)||defined(tahoe) +#if defined(__vax__) return (infnan(EDOM)); /* NaN */ -#else /* defined(__vax__)||defined(tahoe) */ +#else /* defined(__vax__) */ return(zero/zero); -#endif /* defined(__vax__)||defined(tahoe) */ +#endif /* defined(__vax__) */ } /* sqrt(INF) is INF */ @@ -382,13 +356,7 @@ end: return(scalbn(q,n)); double remainder(double x, double y) { - -#ifdef national /* order of words in floating point number */ - static const n0=3, n1=2, n2=1, n3=0; -#else /* VAX, SUN, ZILOG, TAHOE */ static const n0=0, n1=1, n2=2, n3=3; -#endif - static const unsigned short mexp =0x7ff0, m25 =0x0190, m57 =0x0390; double hy, y1, t, t1; short k; @@ -490,11 +458,7 @@ newsqrt(double x) unsigned long *py=(unsigned long *) &y , *pt=(unsigned long *) &t , *px=(unsigned long *) &x ; -#ifdef national /* ordering of word in a floating point number */ - const int n0=1, n1=0; -#else const int n0=0, n1=1; -#endif /* Rounding Mode: RN ...round-to-nearest * RZ ...round-towards 0 * RP ...round-towards +INF diff --git a/lib/libm/noieee_src/n_tan.c b/lib/libm/noieee_src/n_tan.c index edc483636cd..61014e21033 100644 --- a/lib/libm/noieee_src/n_tan.c +++ b/lib/libm/noieee_src/n_tan.c @@ -1,4 +1,4 @@ -/* $OpenBSD: n_tan.c,v 1.4 2008/06/12 22:43:36 martynas Exp $ */ +/* $OpenBSD: n_tan.c,v 1.5 2008/06/21 08:26:19 martynas Exp $ */ /* $NetBSD: n_tan.c,v 1.1 1995/10/10 23:37:07 ragge Exp $ */ /* * Copyright (c) 1987, 1993 @@ -37,8 +37,7 @@ static char sccsid[] = "@(#)tan.c 8.1 (Berkeley) 6/4/93"; #include "mathimpl.h" double -tan(x) -double x; +tan(double x) { double a,z,ss,cc,c; int k; @@ -65,10 +64,6 @@ double x; c = (z >= thresh ? half-((z-half)-cc) : one-(z-cc)); if (k == 0) return x+(x*(z-(cc-ss)))/c; /* ... sin/cos */ -#ifdef national - else if (x == zero) - return copysign(fmax,x); /* no inf on 32k */ -#endif /* national */ else return c/(x+x*ss); /* ... cos/sin */ } diff --git a/lib/libm/noieee_src/n_tanh.c b/lib/libm/noieee_src/n_tanh.c index ab2015da174..d21d4e88916 100644 --- a/lib/libm/noieee_src/n_tanh.c +++ b/lib/libm/noieee_src/n_tanh.c @@ -1,4 +1,4 @@ -/* $OpenBSD: n_tanh.c,v 1.6 2008/06/12 22:43:36 martynas Exp $ */ +/* $OpenBSD: n_tanh.c,v 1.7 2008/06/21 08:26:19 martynas Exp $ */ /* $NetBSD: n_tanh.c,v 1.1 1995/10/10 23:37:08 ragge Exp $ */ /* * Copyright (c) 1985, 1993 @@ -72,8 +72,8 @@ static char sccsid[] = "@(#)tanh.c 8.1 (Berkeley) 6/4/93"; * observed error was 2.22 ulps (units in the last place). */ -double tanh(x) -double x; +double +tanh(double x) { static double one=1.0, two=2.0, small = 1.0e-10, big = 1.0e10; double t, sign; diff --git a/lib/libm/noieee_src/n_tgamma.c b/lib/libm/noieee_src/n_tgamma.c index 096eb715241..afaaaf512c6 100644 --- a/lib/libm/noieee_src/n_tgamma.c +++ b/lib/libm/noieee_src/n_tgamma.c @@ -1,4 +1,4 @@ -/* $OpenBSD: n_tgamma.c,v 1.2 2008/06/16 21:10:30 martynas Exp $ */ +/* $OpenBSD: n_tgamma.c,v 1.3 2008/06/21 08:26:19 martynas Exp $ */ /*- * Copyright (c) 1992, 1993 * The Regents of the University of California. All rights reserved. @@ -127,7 +127,7 @@ static const double zero = 0., one = 1.0, tiny = 1e-300; * TRUNC sets trailing bits in a floating-point number to zero. * is a temporary variable. */ -#if defined(__vax__) || defined(tahoe) +#if defined(__vax__) #define _IEEE 0 #define TRUNC(x) x = (double) (float) (x) #else diff --git a/lib/libm/src/b_exp__D.c b/lib/libm/src/b_exp__D.c index 18f4452d7d5..45cbfe81eda 100644 --- a/lib/libm/src/b_exp__D.c +++ b/lib/libm/src/b_exp__D.c @@ -1,4 +1,4 @@ -/* $OpenBSD: b_exp__D.c,v 1.1 2008/06/11 20:53:27 martynas Exp $ */ +/* $OpenBSD: b_exp__D.c,v 1.2 2008/06/21 08:26:19 martynas Exp $ */ /* * Copyright (c) 1985, 1993 * The Regents of the University of California. All rights reserved. @@ -84,7 +84,8 @@ const static double invln2 = 0x1.71547652b82fep0; /* returns exp(r = x + c) for |c| < |x| with no overlap. */ -double __exp__D(double x, double c) +double +__exp__D(double x, double c) { double z, hi, lo; int k; diff --git a/lib/libm/src/e_j0.c b/lib/libm/src/e_j0.c index ace9def2a59..d49297ca8f3 100644 --- a/lib/libm/src/e_j0.c +++ b/lib/libm/src/e_j0.c @@ -268,8 +268,8 @@ static const double pS2[5] = { 1.46576176948256193810e+01, /* 0x402D50B3, 0x44391809 */ }; -static -double pzero(double x) +static double +pzero(double x) { const double *p,*q; double z,r,s; @@ -364,8 +364,8 @@ static const double qS2[6] = { -5.31095493882666946917e+00, /* 0xC0153E6A, 0xF8B32931 */ }; -static -double qzero(double x) +static double +qzero(double x) { const double *p,*q; double s,r,z; diff --git a/lib/libm/src/w_scalbf.c b/lib/libm/src/w_scalbf.c index 651296b82c6..9542611f1b6 100644 --- a/lib/libm/src/w_scalbf.c +++ b/lib/libm/src/w_scalbf.c @@ -28,7 +28,7 @@ static char rcsid[] = "$NetBSD: w_scalbf.c,v 1.3 1995/05/10 20:49:50 jtc Exp $"; #include <errno.h> -float +float #ifdef _SCALB_INT scalbf(float x, int fn) /* wrapper scalbf */ #else |