msvcrt: Import asinhf 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:13 +02:00 committed by Alexandre Julliard
parent bc9105e238
commit 17174db64a
6 changed files with 18 additions and 20 deletions

1
configure vendored
View File

@ -19617,7 +19617,6 @@ fi
for ac_func in \
asinh \
asinhf \
atanh \
atanhf \
exp2 \

View File

@ -2657,7 +2657,6 @@ fi
AC_CHECK_FUNCS(\
asinh \
asinhf \
atanh \
atanhf \
exp2 \

View File

@ -6577,10 +6577,27 @@ double CDECL asinh(double x)
/*********************************************************************
* asinhf (MSVCR120.@)
*
* Copied from musl: src/math/asinhf.c
*/
float CDECL asinhf(float x)
{
return unix_funcs->asinhf( x );
UINT32 ux = *(UINT32*)&x;
UINT32 i = ux & 0x7fffffff;
int s = ux >> 31;
/* |x| */
x = *(float*)&i;
if (i >= 0x3f800000 + (12 << 23))/* |x| >= 0x1p12 or inf or nan */
x = logf(x) + 0.693147180559945309417232121458176568f;
else if (i >= 0x3f800000 + (1 << 23)) /* |x| >= 2 */
x = logf(2 * x + 1 / (sqrtf(x * x + 1) + x));
else if (i >= 0x3f800000 - (12 << 23)) /* |x| >= 0x1p-12 */
x = log1pf(x + x * x / (sqrtf(x * x + 1) + 1));
else /* |x| < 0x1p-12, raise inexact if x!=0 */
fp_barrierf(x + 0x1p120f);
return s ? -x : x;
}
/*********************************************************************

View File

@ -59,18 +59,6 @@ static double CDECL unix_asinh(double x)
#endif
}
/*********************************************************************
* asinhf
*/
static float CDECL unix_asinhf(float x)
{
#ifdef HAVE_ASINHF
return asinhf(x);
#else
return unix_asinh(x);
#endif
}
/*********************************************************************
* atanh
*/
@ -423,7 +411,6 @@ static float CDECL unix_tgammaf(float x)
static const struct unix_funcs funcs =
{
unix_asinh,
unix_asinhf,
unix_atanh,
unix_atanhf,
unix_cosh,

View File

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

View File

@ -28,9 +28,6 @@
/* Define to 1 if you have the `asinh' function. */
#undef HAVE_ASINH
/* Define to 1 if you have the `asinhf' function. */
#undef HAVE_ASINHF
/* Define to 1 if you have the <asm/types.h> header file. */
#undef HAVE_ASM_TYPES_H