Rewrite handling of integral exponent.
This commit is contained in:
parent
ecc1637a09
commit
334ca6573b
@ -80,51 +80,36 @@ s(__ieee754_pow) (float_type x, float_type y)
|
|||||||
z = 1 / z;
|
z = 1 / z;
|
||||||
if (m81(__signbit) (x))
|
if (m81(__signbit) (x))
|
||||||
{
|
{
|
||||||
float_type temp = m81(__rint) (y);
|
if (y != m81(__rint) (y))
|
||||||
if (y != temp)
|
|
||||||
{
|
{
|
||||||
if (x == -1)
|
if (x == -1)
|
||||||
z = 0.0/0.0;
|
z = 0.0/0.0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
goto maybe_negate;
|
||||||
if (sizeof (float_type) == sizeof (float))
|
|
||||||
{
|
|
||||||
long i = (long) y;
|
|
||||||
if (i & 1)
|
|
||||||
z = -z;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
long long i = (long long) y;
|
|
||||||
if ((float_type) i == y && i & 1)
|
|
||||||
z = -z;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return z;
|
return z;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (x < 0.0)
|
if (x < 0.0)
|
||||||
{
|
{
|
||||||
float_type temp = m81(__rint) (y);
|
if (y == m81(__rint) (y))
|
||||||
if (y == temp)
|
|
||||||
{
|
{
|
||||||
long long i = (long long) y;
|
|
||||||
z = m81(__ieee754_exp) (y * m81(__ieee754_log) (-x));
|
z = m81(__ieee754_exp) (y * m81(__ieee754_log) (-x));
|
||||||
if (sizeof (float_type) == sizeof (float))
|
maybe_negate:
|
||||||
{
|
/* We always use the long double format, since y is already in
|
||||||
long i = (long) y;
|
this format and rounding won't change the result. */
|
||||||
if (i & 1)
|
{
|
||||||
z = -z;
|
int32_t exponent;
|
||||||
}
|
u_int32_t i0, i1;
|
||||||
else
|
GET_LDOUBLE_WORDS (exponent, i0, i1, y);
|
||||||
{
|
exponent = (exponent & 0x7fff) - 0x3fff;
|
||||||
/* If the conversion to long long was inexact assume that y
|
if (exponent <= 31
|
||||||
is an even integer. */
|
? i0 & (1 << (31 - exponent))
|
||||||
if ((float_type) i == y && i & 1)
|
: (exponent <= 63
|
||||||
z = -z;
|
&& i1 & (1 << (63 - exponent))))
|
||||||
}
|
z = -z;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
z = 0.0/0.0;
|
z = 0.0/0.0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user