From e2924fafdf161102903dde9e48f832f5ea80132b Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Fri, 31 Mar 2023 16:47:56 +0200 Subject: [PATCH] msvcrt: Use the acosh()/acoshf() implementation from the bundled musl library. --- dlls/msvcr120/msvcr120.spec | 6 +++--- dlls/msvcrt/math.c | 28 ++++------------------------ dlls/ucrtbase/ucrtbase.spec | 12 ++++++------ 3 files changed, 13 insertions(+), 33 deletions(-) diff --git a/dlls/msvcr120/msvcr120.spec b/dlls/msvcr120/msvcr120.spec index 33bd6efb73e..f536aba9ba3 100644 --- a/dlls/msvcr120/msvcr120.spec +++ b/dlls/msvcr120/msvcr120.spec @@ -2012,9 +2012,9 @@ @ cdecl abs(long) @ cdecl acos(double) @ cdecl -arch=!i386 acosf(float) -@ cdecl acosh(double) -@ cdecl acoshf(float) -@ cdecl acoshl(double) acosh +@ cdecl acosh(double) MSVCRT_acosh +@ cdecl acoshf(float) MSVCRT_acoshf +@ cdecl acoshl(double) MSVCRT_acosh @ cdecl asctime(ptr) @ cdecl asctime_s(ptr long ptr) @ cdecl asin(double) MSVCRT_asin diff --git a/dlls/msvcrt/math.c b/dlls/msvcrt/math.c index ea72ca2f01c..4f95a4747a9 100644 --- a/dlls/msvcrt/math.c +++ b/dlls/msvcrt/math.c @@ -3349,50 +3349,30 @@ int CDECL _fdpcomp(float x, float y) /********************************************************************* * acosh (MSVCR120.@) - * - * Copied from musl: src/math/acosh.c */ -double CDECL acosh(double x) +double CDECL MSVCRT_acosh(double x) { - int e = *(UINT64*)&x >> 52 & 0x7ff; - if (x < 1) { *_errno() = EDOM; feraiseexcept(FE_INVALID); return NAN; } - - if (e < 0x3ff + 1) /* |x| < 2, up to 2ulp error in [1,1.125] */ - return log1p(x - 1 + sqrt((x - 1) * (x - 1) + 2 * (x - 1))); - if (e < 0x3ff + 26) /* |x| < 0x1p26 */ - return log(2 * x - 1 / (x + sqrt(x * x - 1))); - /* |x| >= 0x1p26 or nan */ - return log(x) + 0.693147180559945309417232121458176568; + return acosh( x ); } /********************************************************************* * acoshf (MSVCR120.@) - * - * Copied from musl: src/math/acoshf.c */ -float CDECL acoshf(float x) +float CDECL MSVCRT_acoshf(float x) { - UINT32 a = *(UINT32*)&x & 0x7fffffff; - if (x < 1) { *_errno() = EDOM; feraiseexcept(FE_INVALID); return NAN; } - - if (a < 0x3f800000 + (1 << 23)) /* |x| < 2, up to 2ulp error in [1,1.125] */ - return log1pf(x - 1 + sqrtf((x - 1) * (x - 1) + 2 * (x - 1))); - if (*(UINT32*)&x < 0x3f800000 + (12 << 23)) /* 2 <= x < 0x1p12 */ - return logf(2 * x - 1 / (x + sqrtf(x * x - 1))); - /* x >= 0x1p12 or x <= -2 or nan */ - return logf(x) + 0.693147180559945309417232121458176568f; + return acoshf( x ); } /********************************************************************* diff --git a/dlls/ucrtbase/ucrtbase.spec b/dlls/ucrtbase/ucrtbase.spec index 45d883d410c..5bea04dad62 100644 --- a/dlls/ucrtbase/ucrtbase.spec +++ b/dlls/ucrtbase/ucrtbase.spec @@ -1562,9 +1562,9 @@ @ cdecl _o_abort() abort @ cdecl _o_acos(double) acos @ cdecl -arch=!i386 _o_acosf(float) acosf -@ cdecl _o_acosh(double) acosh -@ cdecl _o_acoshf(float) acoshf -@ cdecl _o_acoshl(double) acosh +@ cdecl _o_acosh(double) MSVCRT_acosh +@ cdecl _o_acoshf(float) MSVCRT_acoshf +@ cdecl _o_acoshl(double) MSVCRT_acosh @ cdecl _o_asctime(ptr) asctime @ cdecl _o_asctime_s(ptr long ptr) asctime_s @ cdecl _o_asin(double) MSVCRT_asin @@ -2156,9 +2156,9 @@ @ cdecl abs(long) @ cdecl acos(double) @ cdecl -arch=!i386 acosf(float) -@ cdecl acosh(double) -@ cdecl acoshf(float) -@ cdecl acoshl(double) acosh +@ cdecl acosh(double) MSVCRT_acosh +@ cdecl acoshf(float) MSVCRT_acoshf +@ cdecl acoshl(double) MSVCRT_acosh @ cdecl asctime(ptr) @ cdecl asctime_s(ptr long ptr) @ cdecl asin(double) MSVCRT_asin