msvcrt: Import acosh 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:10 +02:00 committed by Alexandre Julliard
parent 75537f4375
commit bc9105e238
6 changed files with 11 additions and 21 deletions

1
configure vendored
View File

@ -19616,7 +19616,6 @@ $as_echo "#define HAVE_ISNAN 1" >>confdefs.h
fi
for ac_func in \
acosh \
asinh \
asinhf \
atanh \

View File

@ -2656,7 +2656,6 @@ then
fi
AC_CHECK_FUNCS(\
acosh \
asinh \
asinhf \
atanh \

View File

@ -6585,16 +6585,26 @@ float CDECL asinhf(float x)
/*********************************************************************
* acosh (MSVCR120.@)
*
* Copied from musl: src/math/acosh.c
*/
double CDECL acosh(double x)
{
int e = *(UINT64*)&x >> 52 & 0x7ff;
if (x < 1)
{
*_errno() = EDOM;
feraiseexcept(FE_INVALID);
return NAN;
}
return unix_funcs->acosh( x );
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;
}
/*********************************************************************

View File

@ -42,19 +42,6 @@
WINE_DEFAULT_DEBUG_CHANNEL(msvcrt);
/*********************************************************************
* acosh
*/
static double CDECL unix_acosh(double x)
{
#ifdef HAVE_ACOSH
return acosh(x);
#else
if (!isfinite(x*x)) return log(2) + log(x);
return log(x + sqrt(x*x-1));
#endif
}
/*********************************************************************
* asinh
*/
@ -435,7 +422,6 @@ static float CDECL unix_tgammaf(float x)
static const struct unix_funcs funcs =
{
unix_acosh,
unix_asinh,
unix_asinhf,
unix_atanh,

View File

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

View File

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