From 66451d9590a72c3a6157d5c4378c781955c37386 Mon Sep 17 00:00:00 2001 From: Danny Smith Date: Sun, 6 Oct 2002 23:26:43 +0000 Subject: * mingwex/math/powil.c: Rename powil to __powil. * mingwex/math/powl.c: Adjust declaration and call to __powil. Remove comment on powil. * mingwex/math/powi.c: New file. * mingwex/math/powif.c: New file. * mingwex/math/pow.c: New file. * mingwex/math/cephes_mconf.h. Add double and float versions of constants. (polevl): Add double precision function. (p1evl): Likewise. * mingwex/Makefile.in (MATH_DISTFILES): Add pow.c, powi.c, powif.c. (MATH_OBJS): Add pow.o, powi.o, powif.o. --- winsup/mingw/mingwex/math/cephes_mconf.h | 173 ++++++++++++++++++++++++++++--- 1 file changed, 158 insertions(+), 15 deletions(-) (limited to 'winsup/mingw/mingwex/math/cephes_mconf.h') diff --git a/winsup/mingw/mingwex/math/cephes_mconf.h b/winsup/mingw/mingwex/math/cephes_mconf.h index ba8400f34..1dda63d53 100644 --- a/winsup/mingw/mingwex/math/cephes_mconf.h +++ b/winsup/mingw/mingwex/math/cephes_mconf.h @@ -1,8 +1,45 @@ #include #include + +#define IBMPC 1 +#define ANSIPROT 1 +#define MINUSZERO 1 +#define INFINITIES 1 +#define NANS 1 +#define DENORMAL 1 +#define VOLATILE +#define mtherr(fname, code) +#define XPD 0, + +#ifdef _CEPHES_USE_ERRNO +#define _SET_ERRNO(x) errno = (x) +#else +#define _SET_ERRNO(x) +#endif + /* constants used by cephes functions */ +/* double */ +#define MAXNUM 1.7976931348623158E308 +#define MAXLOG 7.09782712893383996843E2 +#define MINLOG -7.08396418532264106224E2 +#define LOGE2 6.93147180559945309417E-1 +#define LOG2E 1.44269504088896340736 +#define PI 3.14159265358979323846 +#define PIO2 1.57079632679489661923 +#define PIO4 7.85398163397448309616E-1 + +#define NEGZERO (-0.0) +extern double __INF; +#undef INFINITY +#define INFINITY (__INF) +extern double __QNAN; +#undef NAN +#define NAN (__QNAN) + + +/*long double*/ #define MAXNUML 1.189731495357231765021263853E4932L #define MAXLOGL 1.1356523406294143949492E4L #define MINLOGL -1.13994985314888605586758E4L @@ -17,27 +54,133 @@ #define isnanl isnan #define signbitl signbit - -#define IBMPC 1 -#define ANSIPROT 1 -#define MINUSZERO 1 -#define INFINITIES 1 -#define NANS 1 -#define DENORMAL 1 #define NEGZEROL (-0.0L) extern long double __INFL; #define INFINITYL (__INFL) extern long double __QNANL; #define NANL (__QNANL) -#define VOLATILE -#define mtherr(fname, code) -#define XPD 0, -#ifdef _CEPHES_USE_ERRNO -#define _SET_ERRNO(x) errno = (x) -#else -#define _SET_ERRNO(x) -#endif +/* float */ + +#define MAXNUMF 3.4028234663852885981170418348451692544e38F +#define MAXLOGF 88.72283905206835F +#define MINLOGF -103.278929903431851103F /* log(2^-149) */ +#define LOG2EF 1.44269504088896341F +#define LOGE2F 0.693147180559945309F +#define PIF 3.141592653589793238F +#define PIO2F 1.5707963267948966192F +#define PIO4F 0.7853981633974483096F + +#define isfinitef isfinite +#define isinff isinf +#define isnanf isnan +#define signbitf signbit + +#define NEGZEROF (-0.0F) +extern float __INFF; +#define INFINITYF (__INFF) +extern float __QNANF; +#define NANF (__QNANF) + + +/* double */ + +/* +Cephes Math Library Release 2.2: July, 1992 +Copyright 1984, 1987, 1988, 1992 by Stephen L. Moshier +Direct inquiries to 30 Frost Street, Cambridge, MA 02140 +*/ + + +/* polevl.c + * p1evl.c + * + * Evaluate polynomial + * + * + * + * SYNOPSIS: + * + * int N; + * double x, y, coef[N+1], polevl[]; + * + * y = polevl( x, coef, N ); + * + * + * + * DESCRIPTION: + * + * Evaluates polynomial of degree N: + * + * 2 N + * y = C + C x + C x +...+ C x + * 0 1 2 N + * + * Coefficients are stored in reverse order: + * + * coef[0] = C , ..., coef[N] = C . + * N 0 + * + * The function p1evl() assumes that coef[N] = 1.0 and is + * omitted from the array. Its calling arguments are + * otherwise the same as polevl(). + * + * + * SPEED: + * + * In the interest of speed, there are no checks for out + * of bounds arithmetic. This routine is used by most of + * the functions in the library. Depending on available + * equipment features, the user may wish to rewrite the + * program in microcode or assembly language. + * + */ + +/* Polynomial evaluator: + * P[0] x^n + P[1] x^(n-1) + ... + P[n] + */ +static __inline__ double polevl( x, p, n ) +double x; +const void *p; +int n; +{ +register double y; +register double *P = (double *)p; + +y = *P++; +do + { + y = y * x + *P++; + } +while( --n ); +return(y); +} + + + +/* Polynomial evaluator: + * x^n + P[0] x^(n-1) + P[1] x^(n-2) + ... + P[n] + */ +static __inline__ double p1evl( x, p, n ) +double x; +const void *p; +int n; +{ +register double y; +register double *P = (double *)p; + +n -= 1; +y = x + *P++; +do + { + y = y * x + *P++; + } +while( --n ); +return( y ); +} + + +/* long double */ /* Cephes Math Library Release 2.2: July, 1992 Copyright 1984, 1987, 1988, 1992 by Stephen L. Moshier -- cgit v1.2.3