Commit aa224816 authored by Piotr Caban's avatar Piotr Caban Committed by Alexandre Julliard

msvcrt: Implement lrintf using rintf function.

parent 0838c995
......@@ -19642,7 +19642,6 @@ for ac_func in \
log1pf \
log2 \
log2f \
lrintf \
nearbyint \
nearbyintf \
nexttoward \
......
......@@ -2682,7 +2682,6 @@ AC_CHECK_FUNCS(\
log1pf \
log2 \
log2f \
lrintf \
nearbyint \
nearbyintf \
nexttoward \
......
......@@ -4356,7 +4356,15 @@ __msvcrt_long CDECL lrint(double x)
*/
__msvcrt_long CDECL lrintf(float x)
{
return unix_funcs->lrintf( x );
float f;
f = rintf(x);
if ((f < 0 && f != (float)(__msvcrt_long)f)
|| (f >= 0 && f != (float)(__msvcrt_ulong)f)) {
*_errno() = EDOM;
return 0;
}
return f;
}
/*********************************************************************
......
......@@ -556,18 +556,6 @@ static float CDECL unix_logbf( float x )
}
/*********************************************************************
* lrintf
*/
static int CDECL unix_lrintf(float x)
{
#ifdef HAVE_LRINTF
return lrintf(x);
#else
return x >= 0 ? floorf(x + 0.5) : ceilf(x - 0.5);
#endif
}
/*********************************************************************
* modf
*/
static double CDECL unix_modf( double x, double *iptr )
......@@ -882,7 +870,6 @@ static const struct unix_funcs funcs =
unix_log2f,
unix_logb,
unix_logbf,
unix_lrintf,
unix_modf,
unix_modff,
unix_nearbyint,
......
......@@ -72,7 +72,6 @@ struct unix_funcs
float (CDECL *log2f)(float x);
double (CDECL *logb)(double x);
float (CDECL *logbf)(float x);
int (CDECL *lrintf)(float x);
double (CDECL *modf)(double x, double *iptr);
float (CDECL *modff)(float x, float *iptr);
double (CDECL *nearbyint)(double num);
......
......@@ -471,9 +471,6 @@
/* Define to 1 if you have the `log2f' function. */
#undef HAVE_LOG2F
/* Define to 1 if you have the `lrintf' function. */
#undef HAVE_LRINTF
/* Define to 1 if you have the `lstat' function. */
#undef HAVE_LSTAT
......
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