diff options
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 |