diff options
author | Siddhesh Poyarekar <siddhesh@redhat.com> | 2013-03-07 13:23:07 +0530 |
---|---|---|
committer | Siddhesh Poyarekar <siddhesh@redhat.com> | 2013-03-07 13:23:07 +0530 |
commit | 4cc149fd8e96e42515638350fb13887b0d85cdb6 (patch) | |
tree | 821e44a8865c170d7f73eb41c31e0a58ffb75a70 /sysdeps/ieee754/dbl-64/slowpow.c | |
parent | e6ebd4a7d5de4c5afcede367483051e55363b18f (diff) | |
download | glibc-4cc149fd8e96e42515638350fb13887b0d85cdb6.tar.gz glibc-4cc149fd8e96e42515638350fb13887b0d85cdb6.tar.xz glibc-4cc149fd8e96e42515638350fb13887b0d85cdb6.zip |
Merge powerpc slowpow.c into generic code
Diffstat (limited to 'sysdeps/ieee754/dbl-64/slowpow.c')
-rw-r--r-- | sysdeps/ieee754/dbl-64/slowpow.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/sysdeps/ieee754/dbl-64/slowpow.c b/sysdeps/ieee754/dbl-64/slowpow.c index cccc7e32c2..a379728b14 100644 --- a/sysdeps/ieee754/dbl-64/slowpow.c +++ b/sysdeps/ieee754/dbl-64/slowpow.c @@ -59,6 +59,23 @@ __slowpow (double x, double y, double z) if (res >= 0) return res; + /* Compute pow as long double. This is currently only used by powerpc, where + one may get 106 bits of accuracy. */ +#ifdef USE_LONG_DOUBLE_FOR_MP + long double ldw, ldz, ldpp; + static const long double ldeps = 0x4.0p-96; + + ldz = __ieee754_logl ((long double) x); + ldw = (long double) y *ldz; + ldpp = __ieee754_expl (ldw); + res = (double) (ldpp + ldeps); + res1 = (double) (ldpp - ldeps); + + /* Return the result if it is accurate enough. */ + if (res == res1) + return res; +#endif + /* Or else, calculate using multiple precision. P = 10 implies accuracy of 240 bits accuracy, since MP_NO has a radix of 2^24. */ p = 10; |