diff options
author | Joseph Myers <joseph@codesourcery.com> | 2013-08-23 19:45:38 +0000 |
---|---|---|
committer | Joseph Myers <joseph@codesourcery.com> | 2013-08-23 19:45:38 +0000 |
commit | 8fe89494e6516048759425ec30d8878a6233e00f (patch) | |
tree | b3f65b97d02bac4f183da5fe51e01cad8b8a3780 /math/s_cexpl.c | |
parent | 936241e4b2ec90bbb97d1b37bc78726372ec966f (diff) | |
download | glibc-8fe89494e6516048759425ec30d8878a6233e00f.tar.gz |
Fix cexp (NaN + i0) (bug 15532).
Diffstat (limited to 'math/s_cexpl.c')
-rw-r--r-- | math/s_cexpl.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/math/s_cexpl.c b/math/s_cexpl.c index d827bc3de4..0c35603366 100644 --- a/math/s_cexpl.c +++ b/math/s_cexpl.c @@ -145,12 +145,18 @@ __cexpl (__complex__ long double x) } else { - /* If the real part is NaN the result is NaN + iNaN. */ + /* If the real part is NaN the result is NaN + iNaN unless the + imaginary part is zero. */ __real__ retval = __nanl (""); - __imag__ retval = __nanl (""); + if (icls == FP_ZERO) + __imag__ retval = __imag__ x; + else + { + __imag__ retval = __nanl (""); - if (rcls != FP_NAN || icls != FP_NAN) - feraiseexcept (FE_INVALID); + if (rcls != FP_NAN || icls != FP_NAN) + feraiseexcept (FE_INVALID); + } } return retval; |