msvcrt: Import y0 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-28 19:34:23 +02:00 committed by Alexandre Julliard
parent c739e22223
commit 8f8fa9182a
6 changed files with 42 additions and 30 deletions

1
configure vendored
View File

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

View File

@ -2706,7 +2706,6 @@ AC_CHECK_FUNCS(\
tgammaf \
trunc \
truncf \
y0 \
y1 \
yn
)

View File

@ -2696,18 +2696,50 @@ double CDECL _jn(int n, double num)
/*********************************************************************
* _y0 (MSVCRT.@)
*/
double CDECL _y0(double num)
double CDECL _y0(double x)
{
double retval;
static const double tpi = 6.36619772367581382433e-01,
u00 = -7.38042951086872317523e-02,
u01 = 1.76666452509181115538e-01,
u02 = -1.38185671945596898896e-02,
u03 = 3.47453432093683650238e-04,
u04 = -3.81407053724364161125e-06,
u05 = 1.95590137035022920206e-08,
u06 = -3.98205194132103398453e-11,
v01 = 1.27304834834123699328e-02,
v02 = 7.60068627350353253702e-05,
v03 = 2.59150851840457805467e-07,
v04 = 4.41110311332675467403e-10;
if (!isfinite(num)) *_errno() = EDOM;
retval = unix_funcs->y0( 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;
/* y0(nan)=nan, y0(<0)=nan, y0(0)=-inf, y0(inf)=0 */
if ((ix << 1 | lx) == 0)
return math_error(_OVERFLOW, "_y0", x, 0, -INFINITY);
if (isnan(x))
return x;
if (ix >> 31)
return math_error(_DOMAIN, "_y0", x, 0, 0 / (x - x));
if (ix >= 0x7ff00000)
return 1 / x;
if (ix >= 0x40000000) { /* x >= 2 */
/* large ulp errors near zeros: 3.958, 7.086,.. */
return j0_y0_approx(ix, x, TRUE);
}
if (ix >= 0x3e400000) { /* x >= 2**-27 */
/* large ulp error near the first zero, x ~= 0.89 */
z = x * x;
u = u00 + z * (u01 + z * (u02 + z * (u03 + z * (u04 + z * (u05 + z * u06)))));
v = 1.0 + z * (v01 + z * (v02 + z * (v03 + z * v04)));
return u / v + tpi * (j0(x) * log(x));
}
return u00 + tpi * log(x);
}
/*********************************************************************

View File

@ -965,19 +965,6 @@ static float CDECL unix_tgammaf(float x)
#endif
}
/*********************************************************************
* y0
*/
static double CDECL unix_y0(double num)
{
#ifdef HAVE_Y0
return y0(num);
#else
FIXME("not implemented\n");
return 0;
#endif
}
/*********************************************************************
* y1
*/
@ -1093,7 +1080,6 @@ static const struct unix_funcs funcs =
unix_tgammaf,
unix_trunc,
unix_truncf,
unix_y0,
unix_y1,
unix_yn
};

View File

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

View File

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