comparison src/mingw-w64-complex-inverse-trig.patch @ 6354:9d1395334e68

mingw-w64: Handle negative zero input for cacosh (bug #49091). * src/mingw-w64-complex-inverse-trig.patch: Handle negative zero input for cacosh.
author Markus Mützel <markus.muetzel@gmx.de>
date Fri, 05 Aug 2022 19:32:03 +0200
parents 0825abaf61a7
children 6f3c099c0d38
comparison
equal deleted inserted replaced
6353:2e45c970becf 6354:9d1395334e68
65 + || __FLT_ABI(fabs) (__imag__ z) >= __FLT_CST(1.0)/__FLT_EPSILON) 65 + || __FLT_ABI(fabs) (__imag__ z) >= __FLT_CST(1.0)/__FLT_EPSILON)
66 + { 66 + {
67 + /* For large z, z + sqrt(z*z - 1) is approximately 2*z. 67 + /* For large z, z + sqrt(z*z - 1) is approximately 2*z.
68 + Use that approximation to avoid overflow when squaring. 68 + Use that approximation to avoid overflow when squaring.
69 + Additionally, use symmetries to perform the calculation in the positive 69 + Additionally, use symmetries to perform the calculation in the positive
70 + half plain. */ 70 + half plane. */
71 + __real__ x = __real__ z; 71 + __real__ x = __real__ z;
72 + __imag__ x = __FLT_ABI(fabs) (__imag__ z); 72 + __imag__ x = __FLT_ABI(fabs) (__imag__ z);
73 + x = __FLT_ABI(clog) (x); 73 + x = __FLT_ABI(clog) (x);
74 + __real__ x += M_LN2; 74 + __real__ x += M_LN2;
75 + 75 +
84 __imag__ x = __FLT_CST(2.0) * __real__ z * __imag__ z; 84 __imag__ x = __FLT_CST(2.0) * __real__ z * __imag__ z;
85 85
86 -- 86 --
87 2.35.3.windows.1 87 2.35.3.windows.1
88 88
89 From 9fcac91fc50120a5e6acfa94ba0a917c7faf2306 Mon Sep 17 00:00:00 2001
90 From: =?UTF-8?q?Markus=20M=C3=BCtzel?= <markus.muetzel@gmx.de>
91 Date: Fri, 5 Aug 2022 18:36:49 +0200
92 Subject: [PATCH] cacosh: Handle negative zero input
93
94 ---
95 mingw-w64-crt/complex/cacosh.def.h | 4 ++--
96 1 file changed, 2 insertions(+), 2 deletions(-)
97
98 diff --git a/mingw-w64-crt/complex/cacosh.def.h b/mingw-w64-crt/complex/cacosh.def.h
99 index 1f03befae..addf2958e 100644
100 --- a/mingw-w64-crt/complex/cacosh.def.h
101 +++ b/mingw-w64-crt/complex/cacosh.def.h
102 @@ -106,7 +106,7 @@ __FLT_ABI(cacosh) (__FLT_TYPE __complex__ z)
103
104 x = __FLT_ABI(csqrt) (x);
105
106 - if (__real__ z < __FLT_CST(0.0))
107 + if (__FLT_ABI(signbit) (__real__ z))
108 x = -x;
109
110 __real__ x += __real__ z;
111 @@ -114,7 +114,7 @@ __FLT_ABI(cacosh) (__FLT_TYPE __complex__ z)
112
113 ret = __FLT_ABI(clog) (x);
114
115 - if (__real__ ret < __FLT_CST(0.0))
116 + if (__FLT_ABI(signbit) (__real__ ret))
117 ret = -ret;
118
119 return ret;
120 --
121 2.35.3.windows.1
122