Martin Storsjo : msvcrt: Make the cosh function NAN preserving.

Alexandre Julliard julliard at winehq.org
Wed Jul 28 15:37:42 CDT 2021


Module: wine
Branch: master
Commit: 60d178b410ba943c6c39b2ccf1deaec264d7d21a
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=60d178b410ba943c6c39b2ccf1deaec264d7d21a

Author: Martin Storsjo <martin at martin.st>
Date:   Wed Jul 28 14:42:09 2021 +0200

msvcrt: Make the cosh function NAN preserving.

Signed-off-by: Martin Storsjo <martin at martin.st>
Signed-off-by: Piotr Caban <piotr at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/msvcrt/math.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/dlls/msvcrt/math.c b/dlls/msvcrt/math.c
index a902d4f04b9..2bd4206359b 100644
--- a/dlls/msvcrt/math.c
+++ b/dlls/msvcrt/math.c
@@ -2776,6 +2776,7 @@ static double __expo2(double x, double sign)
 double CDECL cosh( double x )
 {
     UINT64 ux = *(UINT64*)&x;
+    UINT64 sign = ux & 0x8000000000000000ULL;
     UINT32 w;
     double t;
 
@@ -2803,7 +2804,10 @@ double CDECL cosh( double x )
 
     /* |x| > log(DBL_MAX) or nan */
     /* note: the result is stored to handle overflow */
-    t = __expo2(x, 1.0);
+    if (ux > 0x7ff0000000000000ULL)
+        *(UINT64*)&t = ux | sign | 0x0008000000000000ULL;
+    else
+        t = __expo2(x, 1.0);
     return t;
 }
 




More information about the wine-cvs mailing list