Commit 09bcc133 authored by Piotr Caban's avatar Piotr Caban Committed by Alexandre Julliard

msvcrt: Import cbrtf implementation from musl.

parent d5eedfc3
...@@ -19623,7 +19623,6 @@ for ac_func in \ ...@@ -19623,7 +19623,6 @@ for ac_func in \
atanh \ atanh \
atanhf \ atanhf \
cbrt \ cbrt \
cbrtf \
erf \ erf \
erfc \ erfc \
erfcf \ erfcf \
......
...@@ -2663,7 +2663,6 @@ AC_CHECK_FUNCS(\ ...@@ -2663,7 +2663,6 @@ AC_CHECK_FUNCS(\
atanh \ atanh \
atanhf \ atanhf \
cbrt \ cbrt \
cbrtf \
erf \ erf \
erfc \ erfc \
erfcf \ erfcf \
......
...@@ -4505,10 +4505,38 @@ double CDECL cbrt(double x) ...@@ -4505,10 +4505,38 @@ double CDECL cbrt(double x)
/********************************************************************* /*********************************************************************
* cbrtf (MSVCR120.@) * cbrtf (MSVCR120.@)
*
* Copied from musl: src/math/cbrtf.c
*/ */
float CDECL cbrtf(float x) float CDECL cbrtf(float x)
{ {
return unix_funcs->cbrtf( x ); static const unsigned B1 = 709958130, B2 = 642849266;
double r,T;
union {float f; UINT32 i;} u = {x};
UINT32 hx = u.i & 0x7fffffff;
if (hx >= 0x7f800000)
return x + x;
if (hx < 0x00800000) { /* zero or subnormal? */
if (hx == 0)
return x;
u.f = x * 0x1p24f;
hx = u.i & 0x7fffffff;
hx = hx / 3 + B2;
} else
hx = hx / 3 + B1;
u.i &= 0x80000000;
u.i |= hx;
T = u.f;
r = T * T * T;
T = T * (x + x + r) / (x + r + r);
r = T * T * T;
T = T * (x + x + r) / (x + r + r);
return T;
} }
/********************************************************************* /*********************************************************************
......
...@@ -134,18 +134,6 @@ static double CDECL unix_cbrt(double x) ...@@ -134,18 +134,6 @@ static double CDECL unix_cbrt(double x)
} }
/********************************************************************* /*********************************************************************
* cbrtf
*/
static float CDECL unix_cbrtf(float x)
{
#ifdef HAVE_CBRTF
return cbrtf(x);
#else
return unix_cbrt(x);
#endif
}
/*********************************************************************
* ceil * ceil
*/ */
static double CDECL unix_ceil( double x ) static double CDECL unix_ceil( double x )
...@@ -738,7 +726,6 @@ static const struct unix_funcs funcs = ...@@ -738,7 +726,6 @@ static const struct unix_funcs funcs =
unix_atanh, unix_atanh,
unix_atanhf, unix_atanhf,
unix_cbrt, unix_cbrt,
unix_cbrtf,
unix_ceil, unix_ceil,
unix_ceilf, unix_ceilf,
unix_cos, unix_cos,
......
...@@ -30,7 +30,6 @@ struct unix_funcs ...@@ -30,7 +30,6 @@ struct unix_funcs
double (CDECL *atanh)(double x); double (CDECL *atanh)(double x);
float (CDECL *atanhf)(float x); float (CDECL *atanhf)(float x);
double (CDECL *cbrt)(double x); double (CDECL *cbrt)(double x);
float (CDECL *cbrtf)(float x);
double (CDECL *ceil)(double x); double (CDECL *ceil)(double x);
float (CDECL *ceilf)(float x); float (CDECL *ceilf)(float x);
double (CDECL *cos)(double x); double (CDECL *cos)(double x);
......
...@@ -70,9 +70,6 @@ ...@@ -70,9 +70,6 @@
/* Define to 1 if you have the `cbrt' function. */ /* Define to 1 if you have the `cbrt' function. */
#undef HAVE_CBRT #undef HAVE_CBRT
/* Define to 1 if you have the `cbrtf' function. */
#undef HAVE_CBRTF
/* Define to 1 if you have the `clock_gettime' function. */ /* Define to 1 if you have the `clock_gettime' function. */
#undef HAVE_CLOCK_GETTIME #undef HAVE_CLOCK_GETTIME
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment