summaryrefslogtreecommitdiff
path: root/libquadmath/math/complex.c
diff options
context:
space:
mode:
authorTobias Burnus <burnus@net-b.de>2012-10-31 16:46:59 +0100
committerTobias Burnus <burnus@gcc.gnu.org>2012-10-31 16:46:59 +0100
commit737df6e61771e330559a152be1653b173012172b (patch)
tree1e8de664570b1111159d9aecd98b3bd2f96c3923 /libquadmath/math/complex.c
parentbe028f913fb3e7fc33d4b97f2c67a346f3ff0215 (diff)
downloadgcc-737df6e61771e330559a152be1653b173012172b.tar.gz
complex.c (csqrtq): NaN and INF fixes.
2012-10-31 Tobias Burnus <burnus@net-b.de> Joseph Myers <joseph@codesourcery.com> David S. Miller <davem@davemloft.net> Ulrich Drepper <drepper@redhat.com> Marek Polacek <polacek@redhat.com>: Petr Baudis <pasky@suse.cz> * math/complex.c (csqrtq): NaN and INF fixes. * math/sqrtq.c (sqrt): NaN, INF and < 0 fixes. * math/expm1q.c (expm1q): Changes from GLIBC. Use expq for large parameters. Fix errno for boundary conditions. * math/finiteq.c (finiteq): Add comment. * math/fmaq.c (fmaq): Changes from GLIBC. Fix missing underflows and bad results for some subnormal results. Fix sign of inexact zero return. Fix sign of exact zero return. Ensure additions are not scheduled after fetestexcept. * math/jnq.c (jnq): Changes from GLIBC. Set up errno properly for ynq. Fix jnq precision. * math/nearbyintq.c (nearbyintq): Changes from GLIBC. Do not manipulate bits before adding and subtracting TWO112[sx]. * math/rintq.c (rintq): Ditto. * math/scalbnq.c (scalbnq): Changes from GLIBC. Fix integer overflow. Co-Authored-By: David S. Miller <davem@davemloft.net> Co-Authored-By: Joseph Myers <joseph@codesourcery.com> Co-Authored-By: Ulrich Drepper <drepper@redhat.com> From-SVN: r193037
Diffstat (limited to 'libquadmath/math/complex.c')
-rw-r--r--libquadmath/math/complex.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/libquadmath/math/complex.c b/libquadmath/math/complex.c
index f67448a2c12..9953f52ca6b 100644
--- a/libquadmath/math/complex.c
+++ b/libquadmath/math/complex.c
@@ -177,7 +177,11 @@ csqrtq (__complex128 z)
if (im == 0)
{
- if (re < 0)
+ if (isnanq (re))
+ {
+ COMPLEX_ASSIGN (v, -re, -re);
+ }
+ else if (re < 0)
{
COMPLEX_ASSIGN (v, 0, copysignq (sqrtq (-re), im));
}
@@ -186,6 +190,10 @@ csqrtq (__complex128 z)
COMPLEX_ASSIGN (v, fabsq (sqrtq (re)), copysignq (0, im));
}
}
+ else if (isinfq (im))
+ {
+ COMPLEX_ASSIGN (v, fabsq (im), im);
+ }
else if (re == 0)
{
__float128 r = sqrtq (0.5 * fabsq (im));