mirror of
git://source.winehq.org/git/wine.git
synced 2024-10-06 16:28:18 +00:00
msvcrt: Import asinh implementation from musl.
Signed-off-by: Piotr Caban <piotr@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
17174db64a
commit
da55a453d1
1
configure
vendored
1
configure
vendored
|
@ -19616,7 +19616,6 @@ $as_echo "#define HAVE_ISNAN 1" >>confdefs.h
|
|||
fi
|
||||
|
||||
for ac_func in \
|
||||
asinh \
|
||||
atanh \
|
||||
atanhf \
|
||||
exp2 \
|
||||
|
|
|
@ -2656,7 +2656,6 @@ then
|
|||
fi
|
||||
|
||||
AC_CHECK_FUNCS(\
|
||||
asinh \
|
||||
atanh \
|
||||
atanhf \
|
||||
exp2 \
|
||||
|
|
|
@ -6569,10 +6569,28 @@ double CDECL fmin(double x, double y)
|
|||
|
||||
/*********************************************************************
|
||||
* asinh (MSVCR120.@)
|
||||
*
|
||||
* Copied from musl: src/math/asinh.c
|
||||
*/
|
||||
double CDECL asinh(double x)
|
||||
{
|
||||
return unix_funcs->asinh( x );
|
||||
UINT64 ux = *(UINT64*)&x;
|
||||
int e = ux >> 52 & 0x7ff;
|
||||
int s = ux >> 63;
|
||||
|
||||
/* |x| */
|
||||
ux &= (UINT64)-1 / 2;
|
||||
x = *(double*)&ux;
|
||||
|
||||
if (e >= 0x3ff + 26) /* |x| >= 0x1p26 or inf or nan */
|
||||
x = log(x) + 0.693147180559945309417232121458176568;
|
||||
else if (e >= 0x3ff + 1) /* |x| >= 2 */
|
||||
x = log(2 * x + 1 / (sqrt(x * x + 1) + x));
|
||||
else if (e >= 0x3ff - 26) /* |x| >= 0x1p-26 */
|
||||
x = log1p(x + x * x / (sqrt(x * x + 1) + 1));
|
||||
else /* |x| < 0x1p-26, raise inexact if x != 0 */
|
||||
fp_barrier(x + 0x1p120f);
|
||||
return s ? -x : x;
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
|
|
|
@ -42,23 +42,6 @@
|
|||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(msvcrt);
|
||||
|
||||
/*********************************************************************
|
||||
* asinh
|
||||
*/
|
||||
static double CDECL unix_asinh(double x)
|
||||
{
|
||||
#ifdef HAVE_ASINH
|
||||
return asinh(x);
|
||||
#else
|
||||
if (!isfinite(x*x+1))
|
||||
{
|
||||
if (x > 0) return log(2) + log(x);
|
||||
else return -log(2) - log(-x);
|
||||
}
|
||||
return log(x + sqrt(x*x+1));
|
||||
#endif
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
* atanh
|
||||
*/
|
||||
|
@ -410,7 +393,6 @@ static float CDECL unix_tgammaf(float x)
|
|||
|
||||
static const struct unix_funcs funcs =
|
||||
{
|
||||
unix_asinh,
|
||||
unix_atanh,
|
||||
unix_atanhf,
|
||||
unix_cosh,
|
||||
|
|
|
@ -23,7 +23,6 @@
|
|||
|
||||
struct unix_funcs
|
||||
{
|
||||
double (CDECL *asinh)(double x);
|
||||
double (CDECL *atanh)(double x);
|
||||
float (CDECL *atanhf)(float x);
|
||||
double (CDECL *cosh)(double x);
|
||||
|
|
|
@ -25,9 +25,6 @@
|
|||
/* Define to 1 if you have the <arpa/nameser.h> header file. */
|
||||
#undef HAVE_ARPA_NAMESER_H
|
||||
|
||||
/* Define to 1 if you have the `asinh' function. */
|
||||
#undef HAVE_ASINH
|
||||
|
||||
/* Define to 1 if you have the <asm/types.h> header file. */
|
||||
#undef HAVE_ASM_TYPES_H
|
||||
|
||||
|
|
Loading…
Reference in a new issue