12 #define mtherr(fname, code)
15 #define XPD_SHORT 0, 0,
23 typedef union uLD
{ long double ld
; unsigned short sh
[8]; long lo
[4]; } uLD
;
24 typedef union uD
{ double d
; unsigned short sh
[4]; } uD
;
26 typedef union uLD
{ unsigned short sh
[8]; long double ld
; long lo
[4]; } uLD
;
27 typedef union uD
{ unsigned short sh
[4]; double d
; } uD
;
29 typedef union uLD
{ long lo
[4]; long double ld
; unsigned short sh
[8]; } uLD
;
30 typedef union uD
{ unsigned short sh
[4]; double d
; } uD
;
32 #error Unknown uLD/uD type definition
35 #define _CEPHES_USE_ERRNO
37 #ifdef _CEPHES_USE_ERRNO
38 #define _SET_ERRNO(x) errno = (x)
43 /* constants used by cephes functions */
46 #define MAXNUM 1.7976931348623158E308
47 #define MAXLOG 7.09782712893383996843E2
48 #define MINLOG -7.08396418532264106224E2
49 #define LOGE2 6.93147180559945309417E-1
50 #define LOG2E 1.44269504088896340736
51 #define PI 3.14159265358979323846
52 #define PIO2 1.57079632679489661923
53 #define PIO4 7.85398163397448309616E-1
55 #define NEGZERO (-0.0)
58 #if (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 2))
59 #define INFINITY __builtin_huge_val()
60 #define NAN __builtin_nan("")
63 #define INFINITY (__INF)
69 #if defined(__arm__) || defined(_ARM_)
70 #define MAXNUML 1.7976931348623158E308
71 #define MAXLOGL 7.09782712893383996843E2
72 #define MINLOGL -7.08396418532264106224E2
73 #define LOGE2L 6.93147180559945309417E-1
74 #define LOG2EL 1.44269504088896340736
75 #define PIL 3.14159265358979323846
76 #define PIO2L 1.57079632679489661923
77 #define PIO4L 7.85398163397448309616E-1
79 #define MAXNUML 1.189731495357231765021263853E4932L
80 #define MAXLOGL 1.1356523406294143949492E4L
81 #define MINLOGL -1.13994985314888605586758E4L
82 #define LOGE2L 6.9314718055994530941723E-1L
83 #define LOG2EL 1.4426950408889634073599E0L
84 #define PIL 3.1415926535897932384626L
85 #define PIO2L 1.5707963267948966192313L
86 #define PIO4L 7.8539816339744830961566E-1L
87 #endif /* defined(__arm__) || defined(_ARM_) */
89 #define isfinitel isfinite
92 #define signbitl signbit
94 #define NEGZEROL (-0.0L)
98 #if (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 2))
99 #define INFINITYL __builtin_huge_vall()
100 #define NANL __builtin_nanl("")
102 extern long double __INFL
;
103 #define INFINITYL (__INFL)
104 extern long double __QNANL
;
105 #define NANL (__QNANL)
110 #define MAXNUMF 3.4028234663852885981170418348451692544e38F
111 #define MAXLOGF 88.72283905206835F
112 #define MINLOGF -103.278929903431851103F /* log(2^-149) */
113 #define LOG2EF 1.44269504088896341F
114 #define LOGE2F 0.693147180559945309F
115 #define PIF 3.141592653589793238F
116 #define PIO2F 1.5707963267948966192F
117 #define PIO4F 0.7853981633974483096F
119 #define isfinitef isfinite
122 #define signbitf signbit
124 #define NEGZEROF (-0.0F)
128 #if (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 2))
129 #define INFINITYF __builtin_huge_valf()
130 #define NANF __builtin_nanf("")
133 #define INFINITYF (__INFF)
134 extern float __QNANF
;
135 #define NANF (__QNANF)
142 Cephes Math Library Release 2.2: July, 1992
143 Copyright 1984, 1987, 1988, 1992 by Stephen L. Moshier
144 Direct inquiries to 30 Frost Street, Cambridge, MA 02140
151 * Evaluate polynomial
158 * double x, y, coef[N+1], polevl[];
160 * y = polevl( x, coef, N );
166 * Evaluates polynomial of degree N:
169 * y = C + C x + C x +...+ C x
172 * Coefficients are stored in reverse order:
174 * coef[0] = C , ..., coef[N] = C .
177 * The function p1evl() assumes that coef[N] = 1.0 and is
178 * omitted from the array. Its calling arguments are
179 * otherwise the same as polevl().
184 * In the interest of speed, there are no checks for out
185 * of bounds arithmetic. This routine is used by most of
186 * the functions in the library. Depending on available
187 * equipment features, the user may wish to rewrite the
188 * program in microcode or assembly language.
192 /* Polynomial evaluator:
193 * P[0] x^n + P[1] x^(n-1) + ... + P[n]
195 static __inline__
double polevl(double x
, const uD
*p
, int n
)
211 /* Polynomial evaluator:
212 * x^n + P[0] x^(n-1) + P[1] x^(n-2) + ... + P[n]
214 static __inline__
double p1evl(double x
, const uD
*p
, int n
)
222 y
= y
* x
+ p
->d
; p
++;
231 Cephes Math Library Release 2.2: July, 1992
232 Copyright 1984, 1987, 1988, 1992 by Stephen L. Moshier
233 Direct inquiries to 30 Frost Street, Cambridge, MA 02140
240 * Evaluate polynomial
247 * long double x, y, coef[N+1], polevl[];
249 * y = polevll( x, coef, N );
255 * Evaluates polynomial of degree N:
258 * y = C + C x + C x +...+ C x
261 * Coefficients are stored in reverse order:
263 * coef[0] = C , ..., coef[N] = C .
266 * The function p1evll() assumes that coef[N] = 1.0 and is
267 * omitted from the array. Its calling arguments are
268 * otherwise the same as polevll().
273 * In the interest of speed, there are no checks for out
274 * of bounds arithmetic. This routine is used by most of
275 * the functions in the library. Depending on available
276 * equipment features, the user may wish to rewrite the
277 * program in microcode or assembly language.
281 /* Polynomial evaluator:
282 * P[0] x^n + P[1] x^(n-1) + ... + P[n]
284 static __inline__
long double polevll(long double x
, const uLD
*p
, int n
)
286 register long double y
;
301 /* Polynomial evaluator:
302 * x^n + P[0] x^(n-1) + P[1] x^(n-2) + ... + P[n]
304 static __inline__
long double p1evll(long double x
, const uLD
*p
, int n
)
306 register long double y
;
326 * Evaluate polynomial
333 * float x, y, coef[N+1], polevlf[];
335 * y = polevlf( x, coef, N );
341 * Evaluates polynomial of degree N:
344 * y = C + C x + C x +...+ C x
347 * Coefficients are stored in reverse order:
349 * coef[0] = C , ..., coef[N] = C .
352 * The function p1evl() assumes that coef[N] = 1.0 and is
353 * omitted from the array. Its calling arguments are
354 * otherwise the same as polevl().
359 * In the interest of speed, there are no checks for out
360 * of bounds arithmetic. This routine is used by most of
361 * the functions in the library. Depending on available
362 * equipment features, the user may wish to rewrite the
363 * program in microcode or assembly language.
368 Cephes Math Library Release 2.1: December, 1988
369 Copyright 1984, 1987, 1988 by Stephen L. Moshier
370 Direct inquiries to 30 Frost Street, Cambridge, MA 02140
373 static __inline__
float polevlf(float x
, const float* coef
, int N
)
383 for (i = 0; i < N; i++)
384 ans = ans * x + *p++;
389 ans
= ans
* x
+ *p
++;
397 * Evaluate polynomial when coefficient of x is 1.0.
398 * Otherwise same as polevl.
401 static __inline__
float p1evlf(float x
, const float *coef
, int N
)
412 ans
= ans
* x
+ *p
++;