Fix return of cexp for NaN + 0i. Fixes the return value of cexp to match Annex G.6.3.1; when the parameter is NaN + 0i, we should return NaN + 0i, and not NaN + NaN. mingw-w64-crt/ChangeLog: 2010-06-27 Doug Semler <dougsemler@gmail.com> * new_complex/cexp.def.h (cexp): Return imaginary zero when NaN + 0i. git-svn-id: svn+ssh://svn.code.sf.net/p/mingw-w64/code/trunk@2672 4407c894-4637-0410-b4f5-ada5f102cad1
diff --git a/mingw-w64-crt/ChangeLog b/mingw-w64-crt/ChangeLog index f6069f4..9b02ea1 100644 --- a/mingw-w64-crt/ChangeLog +++ b/mingw-w64-crt/ChangeLog
@@ -1,4 +1,8 @@ -2010-06-27 Doug Semler <dougsemler@gmail.com> +2010-06-27 Doug Semler <dougsemler@gmail.com> + + * new_complex/cexp.def.h (cexp): Return imaginary zero when NaN + 0i. + +2010-06-27 Doug Semler <dougsemler@gmail.com> * math/hypotl (hypotl): Return +infinity when either of the inputs is an infinity, including when the other is NaN (Annex F.9.4.3)
diff --git a/mingw-w64-crt/new_complex/cexp.def.h b/mingw-w64-crt/new_complex/cexp.def.h index 8ab7660..c0c97b7 100644 --- a/mingw-w64-crt/new_complex/cexp.def.h +++ b/mingw-w64-crt/new_complex/cexp.def.h
@@ -86,7 +86,10 @@ if (r_class == FP_NAN || i_class == FP_NAN || i_class == FP_INFINITE) { __real__ ret = __FLT_NAN; - __imag__ ret = __FLT_NAN; + if (i_class == FP_ZERO) + __imag__ ret = __FLT_ABI(copysign) (__FLT_CST(0.0), __imag__ z); + else + __imag__ ret = __FLT_NAN; return ret; }