Commit 0838c995 authored by Piotr Caban's avatar Piotr Caban Committed by Alexandre Julliard

msvcrt: Implement lrint using rint function.

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