2
* This file has no copyright assigned and is placed in the Public Domain.
3
* This file is part of the w64 mingw-runtime package.
4
* No warranty is given; refer to the file DISCLAIMER.PD within this package.
6
#include "cephes_mconf.h"
11
float __powif (float x, int nn);
13
float __powif (float x, int nn)
15
int n, e, sign, asign, lx;
18
/* See pow.c for these tests. */
59
/* Even power will be positive. */
63
/* Overflow detection */
65
/* Calculate approximate logarithm of answer */
68
if ((e == 0) || (e > 64) || (e < -64))
70
s = (s - 7.0710678118654752e-1) / (s + 7.0710678118654752e-1);
71
s = (2.9142135623730950 * s - 0.5 + lx) * nn * LOGE2F;
80
mtherr("__powif", OVERFLOW);
93
/* Handle tiny denormal answer, but with less accuracy
94
* since roundoff error in 1.0/x will be amplified.
95
* The precise demarcation should be the gradual underflow threshold.
97
if ((s < (-MAXLOGF+2.0)) && (sign < 0))
103
/* do not produce denormal answer */
108
/* First bit of the power */
118
w = w * w; /* arg to the 2-to-the-kth power */
119
if (n & 1) /* if that bit is set, then include in product */
131
/* odd power of negative number */