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 \ tgammaf \
trunc \ trunc \
truncf \ truncf \
y0 \
y1 \ y1 \
yn yn

View file

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

View file

@ -2696,18 +2696,50 @@ double CDECL _jn(int n, double num)
/********************************************************************* /*********************************************************************
* _y0 (MSVCRT.@) * _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; double z, u, v;
retval = unix_funcs->y0( num ); unsigned int ix, lx;
if (_fpclass(retval) == _FPCLASS_NINF)
{ ix = *(ULONGLONG*)&x >> 32;
*_errno() = EDOM; lx = *(ULONGLONG*)&x;
retval = NAN;
} /* y0(nan)=nan, y0(<0)=nan, y0(0)=-inf, y0(inf)=0 */
return retval; 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 #endif
} }
/*********************************************************************
* y0
*/
static double CDECL unix_y0(double num)
{
#ifdef HAVE_Y0
return y0(num);
#else
FIXME("not implemented\n");
return 0;
#endif
}
/********************************************************************* /*********************************************************************
* y1 * y1
*/ */
@ -1093,7 +1080,6 @@ static const struct unix_funcs funcs =
unix_tgammaf, unix_tgammaf,
unix_trunc, unix_trunc,
unix_truncf, unix_truncf,
unix_y0,
unix_y1, unix_y1,
unix_yn unix_yn
}; };

View file

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

View file

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