msvcrt: Import y1 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-04-29 17:06:19 +02:00 committed by Alexandre Julliard
parent 3911ac3f45
commit e10bd6f46f
6 changed files with 36 additions and 30 deletions

1
configure vendored
View File

@ -19662,7 +19662,6 @@ for ac_func in \
tgammaf \
trunc \
truncf \
y1 \
yn
do :

View File

@ -2705,7 +2705,6 @@ AC_CHECK_FUNCS(\
tgammaf \
trunc \
truncf \
y1 \
yn
)
LIBS="$ac_save_LIBS"

View File

@ -2971,18 +2971,44 @@ double CDECL _y0(double x)
/*********************************************************************
* _y1 (MSVCRT.@)
*/
double CDECL _y1(double num)
double CDECL _y1(double x)
{
double retval;
static const double tpi = 6.36619772367581382433e-01,
u00 = -1.96057090646238940668e-01,
u01 = 5.04438716639811282616e-02,
u02 = -1.91256895875763547298e-03,
u03 = 2.35252600561610495928e-05,
u04 = -9.19099158039878874504e-08,
v00 = 1.99167318236649903973e-02,
v01 = 2.02552581025135171496e-04,
v02 = 1.35608801097516229404e-06,
v03 = 6.22741452364621501295e-09,
v04 = 1.66559246207992079114e-11;
if (!isfinite(num)) *_errno() = EDOM;
retval = unix_funcs->y1( num );
if (_fpclass(retval) == _FPCLASS_NINF)
{
*_errno() = EDOM;
retval = NAN;
}
return retval;
double z, u, v;
unsigned int ix, lx;
ix = *(ULONGLONG*)&x >> 32;
lx = *(ULONGLONG*)&x;
/* y1(nan)=nan, y1(<0)=nan, y1(0)=-inf, y1(inf)=0 */
if ((ix << 1 | lx) == 0)
return math_error(_OVERFLOW, "_y1", x, 0, -INFINITY);
if (isnan(x))
return x;
if (ix >> 31)
return math_error(_DOMAIN, "_y1", x, 0, 0 / (x - x));
if (ix >= 0x7ff00000)
return 1 / x;
if (ix >= 0x40000000) /* x >= 2 */
return j1_y1_approx(ix, x, TRUE, 0);
if (ix < 0x3c900000) /* x < 2**-54 */
return -tpi / x;
z = x * x;
u = u00 + z * (u01 + z * (u02 + z * (u03 + z * u04)));
v = 1 + z * (v00 + z * (v01 + z * (v02 + z * (v03 + z * v04))));
return x * (u / v) + tpi * (j1(x) * log(x) - 1 / x);
}
/*********************************************************************

View File

@ -952,19 +952,6 @@ static float CDECL unix_tgammaf(float x)
#endif
}
/*********************************************************************
* y1
*/
static double CDECL unix_y1(double num)
{
#ifdef HAVE_Y1
return y1(num);
#else
FIXME("not implemented\n");
return 0;
#endif
}
/*********************************************************************
* yn
*/
@ -1066,7 +1053,6 @@ static const struct unix_funcs funcs =
unix_tgammaf,
unix_trunc,
unix_truncf,
unix_y1,
unix_yn
};

View File

@ -109,7 +109,6 @@ struct unix_funcs
float (CDECL *tgammaf)(float x);
double (CDECL *trunc)(double x);
float (CDECL *truncf)(float x);
double (CDECL *y1)(double num);
double (CDECL *yn)(int order, double num);
};

View File

@ -1169,9 +1169,6 @@
/* Define if Xrandr has the XRRGetProviderResources function */
#undef HAVE_XRRGETPROVIDERRESOURCES
/* Define to 1 if you have the `y1' function. */
#undef HAVE_Y1
/* Define to 1 if you have the `yn' function. */
#undef HAVE_YN