Handle more pow cases (#61)

This commit is contained in:
Justine Tunney 2021-03-04 06:13:32 -08:00
parent 1a08594f95
commit 43b2475aaa
6 changed files with 45 additions and 21 deletions

View file

@ -31,7 +31,11 @@ long double powl(long double x, long double y) {
asm("fprem" : "=t"(t) : "0"(u), "u"(1.L));
asm("f2xm1" : "=t"(t) : "0"(t));
asm("fscale" : "=t"(t) : "0"(t + 1), "u"(u));
return copysignl(t, x);
if (signbit(x)) {
if (y != truncl(y)) return -NAN;
if (!signbit(y) || ((int64_t)y & 1)) t = -t;
}
return t;
} else if (y > 0) {
return 0;
} else if (!y) {