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

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


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

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

msvcrt: Make the coshf 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 4e5dedd3576..92bf12b4d54 100644
--- a/dlls/msvcrt/math.c
+++ b/dlls/msvcrt/math.c
@@ -1137,6 +1137,7 @@ static float __expo2f(float x, float sign)
 float CDECL coshf( float x )
 {
     UINT32 ui = *(UINT32*)&x;
+    UINT32 sign = ui & 0x80000000;
     float t;
 
     /* |x| */
@@ -1160,7 +1161,10 @@ float CDECL coshf( float x )
     }
 
     /* |x| > log(FLT_MAX) or nan */
-    t = __expo2f(x, 1.0f);
+    if (ui > 0x7f800000)
+        *(UINT32*)&t = ui | sign | 0x400000;
+    else
+        t = __expo2f(x, 1.0f);
     return t;
 }
 




More information about the wine-cvs mailing list