msvcrt: Use the acosh()/acoshf() implementation from the bundled musl library.

This commit is contained in:
Alexandre Julliard 2023-03-31 16:47:56 +02:00
parent 6e9dd141a8
commit e2924fafdf
3 changed files with 13 additions and 33 deletions

View file

@ -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

View file

@ -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 );
}
/*********************************************************************

View file

@ -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