msvcrt: Import acoshf implementation from musl.

Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Piotr Caban 2021-05-25 15:21:06 +02:00 committed by Alexandre Julliard
parent 9b19a110ea
commit 75537f4375
6 changed files with 11 additions and 20 deletions

1
configure vendored
View File

@ -19617,7 +19617,6 @@ fi
for ac_func in \
acosh \
acoshf \
asinh \
asinhf \
atanh \

View File

@ -2657,7 +2657,6 @@ fi
AC_CHECK_FUNCS(\
acosh \
acoshf \
asinh \
asinhf \
atanh \

View File

@ -6599,16 +6599,26 @@ double CDECL acosh(double x)
/*********************************************************************
* acoshf (MSVCR120.@)
*
* Copied from musl: src/math/acoshf.c
*/
float CDECL acoshf(float x)
{
UINT32 a = *(UINT32*)&x & 0x7fffffff;
if (x < 1)
{
*_errno() = EDOM;
feraiseexcept(FE_INVALID);
return NAN;
}
return unix_funcs->acoshf( x );
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;
}
/*********************************************************************

View File

@ -55,18 +55,6 @@ static double CDECL unix_acosh(double x)
#endif
}
/*********************************************************************
* acoshf
*/
static float CDECL unix_acoshf(float x)
{
#ifdef HAVE_ACOSHF
return acoshf(x);
#else
return unix_acosh(x);
#endif
}
/*********************************************************************
* asinh
*/
@ -448,7 +436,6 @@ static float CDECL unix_tgammaf(float x)
static const struct unix_funcs funcs =
{
unix_acosh,
unix_acoshf,
unix_asinh,
unix_asinhf,
unix_atanh,

View File

@ -24,7 +24,6 @@
struct unix_funcs
{
double (CDECL *acosh)(double x);
float (CDECL *acoshf)(float x);
double (CDECL *asinh)(double x);
float (CDECL *asinhf)(float x);
double (CDECL *atanh)(double x);

View File

@ -12,9 +12,6 @@
/* Define to 1 if you have the `acosh' function. */
#undef HAVE_ACOSH
/* Define to 1 if you have the `acoshf' function. */
#undef HAVE_ACOSHF
/* Define to 1 if you have the <alias.h> header file. */
#undef HAVE_ALIAS_H