Martin Storsjo : msvcrt: Make the tanhf function NAN preserving.
Alexandre Julliard
julliard at winehq.org
Wed Jul 28 15:37:42 CDT 2021
Module: wine
Branch: master
Commit: e93e2467195c4cc363d567f1be2ab87b61988b26
URL: https://source.winehq.org/git/wine.git/?a=commit;h=e93e2467195c4cc363d567f1be2ab87b61988b26
Author: Martin Storsjo <martin at martin.st>
Date: Wed Jul 28 14:42:03 2021 +0200
msvcrt: Make the tanhf 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 | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/dlls/msvcrt/math.c b/dlls/msvcrt/math.c
index 29912431bcd..a902d4f04b9 100644
--- a/dlls/msvcrt/math.c
+++ b/dlls/msvcrt/math.c
@@ -1881,21 +1881,24 @@ float CDECL tanf( float x )
float CDECL tanhf( float x )
{
UINT32 ui = *(UINT32*)&x;
- int sign;
+ UINT32 sign = ui & 0x80000000;
float t;
/* x = |x| */
- sign = ui >> 31;
ui &= 0x7fffffff;
x = *(float*)&ui;
if (ui > 0x3f0c9f54) {
/* |x| > log(3)/2 ~= 0.5493 or nan */
if (ui > 0x41200000) {
+ if (ui > 0x7f800000) {
+ *(UINT32*)&x = ui | sign | 0x400000;
#if _MSVCR_VER < 140
- if (isnan(x))
return math_error(_DOMAIN, "tanhf", x, 0, x);
+#else
+ return x;
#endif
+ }
/* |x| > 10 */
fp_barrierf(x + 0x1p120f);
t = 1 + 0 / x;
More information about the wine-cvs
mailing list