diff options
author | Michael Meissner <meissner@linux.vnet.ibm.com> | 2017-09-01 22:10:57 +0000 |
---|---|---|
committer | Michael Meissner <meissner@gcc.gnu.org> | 2017-09-01 22:10:57 +0000 |
commit | 0c949f0a1ce9cfa8c48e62628493140d60e65ea7 (patch) | |
tree | 19ec6e67a88c3251f2fa78dbe04a44c337eaeaf0 /libquadmath/math/sqrtq.c | |
parent | fe920c2d9f479c2b17d6963973cf11efe0169293 (diff) | |
download | gcc-0c949f0a1ce9cfa8c48e62628493140d60e65ea7.zip gcc-0c949f0a1ce9cfa8c48e62628493140d60e65ea7.tar.gz gcc-0c949f0a1ce9cfa8c48e62628493140d60e65ea7.tar.bz2 |
re PR libquadmath/81848 (Add PowerPC support to libquadmath)
2017-09-01 Michael Meissner <meissner@linux.vnet.ibm.com>
PR libquadmath/81848
* configure.ac (powerpc*-linux*): Use attribute mode KC to create
complex __float128 on PowerPC instead of attribute mode TC.
* quadmath.h (__complex128): Likewise.
* configure: Regenerate.
* math/cbrtq.c (CBRT2): Use __float128 not long double.
(CBRT4): Likewise.
(CBRT2I): Likewise.
(CBRT4I): Likewise.
* math/j0q.c (U0): Likewise.
* math/sqrtq.c (sqrtq): Don't depend on implicit conversion
between __float128, instead explicitly convert the __float128
value to long double because the PowerPC does not allow __float128
and long double in the same expression.
From-SVN: r251613
Diffstat (limited to 'libquadmath/math/sqrtq.c')
-rw-r--r-- | libquadmath/math/sqrtq.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/libquadmath/math/sqrtq.c b/libquadmath/math/sqrtq.c index f63c0d1..56ea5d3 100644 --- a/libquadmath/math/sqrtq.c +++ b/libquadmath/math/sqrtq.c @@ -32,14 +32,17 @@ sqrtq (const __float128 x) } #ifdef HAVE_SQRTL - if (x <= LDBL_MAX && x >= LDBL_MIN) { - /* Use long double result as starting point. */ - y = sqrtl ((long double) x); - - /* One Newton iteration. */ - y -= 0.5q * (y - x / y); - return y; + long double xl = (long double) x; + if (xl <= LDBL_MAX && xl >= LDBL_MIN) + { + /* Use long double result as starting point. */ + y = (__float128) sqrtl (xl); + + /* One Newton iteration. */ + y -= 0.5q * (y - x / y); + return y; + } } #endif |