mirror of
git://source.winehq.org/git/wine.git
synced 2024-10-14 21:57:18 +00:00
msvcrt: Import neabyint implementation from musl.
Signed-off-by: Piotr Caban <piotr@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
2caca43733
commit
854a3cab4c
1
configure
vendored
1
configure
vendored
|
@ -19640,7 +19640,6 @@ for ac_func in \
|
||||||
log1pf \
|
log1pf \
|
||||||
log2 \
|
log2 \
|
||||||
log2f \
|
log2f \
|
||||||
nearbyint \
|
|
||||||
nexttoward \
|
nexttoward \
|
||||||
nexttowardf \
|
nexttowardf \
|
||||||
remainder \
|
remainder \
|
||||||
|
|
|
@ -2680,7 +2680,6 @@ AC_CHECK_FUNCS(\
|
||||||
log1pf \
|
log1pf \
|
||||||
log2 \
|
log2 \
|
||||||
log2f \
|
log2f \
|
||||||
nearbyint \
|
|
||||||
nexttoward \
|
nexttoward \
|
||||||
nexttowardf \
|
nexttowardf \
|
||||||
remainder \
|
remainder \
|
||||||
|
|
|
@ -3418,10 +3418,19 @@ double CDECL _yn(int n, double x)
|
||||||
|
|
||||||
/*********************************************************************
|
/*********************************************************************
|
||||||
* _nearbyint (MSVCR120.@)
|
* _nearbyint (MSVCR120.@)
|
||||||
|
*
|
||||||
|
* Based on musl: src/math/nearbyteint.c
|
||||||
*/
|
*/
|
||||||
double CDECL nearbyint(double num)
|
double CDECL nearbyint(double x)
|
||||||
{
|
{
|
||||||
return unix_funcs->nearbyint( num );
|
fenv_t env;
|
||||||
|
|
||||||
|
fegetenv(&env);
|
||||||
|
_control87(_MCW_EM, _MCW_EM);
|
||||||
|
x = rint(x);
|
||||||
|
feclearexcept(FE_INEXACT);
|
||||||
|
feupdateenv(&env);
|
||||||
|
return x;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*********************************************************************
|
/*********************************************************************
|
||||||
|
|
|
@ -547,18 +547,6 @@ static float CDECL unix_modff( float x, float *iptr )
|
||||||
return modff( x, iptr );
|
return modff( x, iptr );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*********************************************************************
|
|
||||||
* nearbyint
|
|
||||||
*/
|
|
||||||
static double CDECL unix_nearbyint(double num)
|
|
||||||
{
|
|
||||||
#ifdef HAVE_NEARBYINT
|
|
||||||
return nearbyint(num);
|
|
||||||
#else
|
|
||||||
return num >= 0 ? floor(num + 0.5) : ceil(num - 0.5);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
/*********************************************************************
|
/*********************************************************************
|
||||||
* nextafter
|
* nextafter
|
||||||
*/
|
*/
|
||||||
|
@ -834,7 +822,6 @@ static const struct unix_funcs funcs =
|
||||||
unix_logbf,
|
unix_logbf,
|
||||||
unix_modf,
|
unix_modf,
|
||||||
unix_modff,
|
unix_modff,
|
||||||
unix_nearbyint,
|
|
||||||
unix_nextafter,
|
unix_nextafter,
|
||||||
unix_nextafterf,
|
unix_nextafterf,
|
||||||
unix_nexttoward,
|
unix_nexttoward,
|
||||||
|
|
|
@ -72,7 +72,6 @@ struct unix_funcs
|
||||||
float (CDECL *logbf)(float x);
|
float (CDECL *logbf)(float x);
|
||||||
double (CDECL *modf)(double x, double *iptr);
|
double (CDECL *modf)(double x, double *iptr);
|
||||||
float (CDECL *modff)(float x, float *iptr);
|
float (CDECL *modff)(float x, float *iptr);
|
||||||
double (CDECL *nearbyint)(double num);
|
|
||||||
double (CDECL *nextafter)(double x, double y);
|
double (CDECL *nextafter)(double x, double y);
|
||||||
float (CDECL *nextafterf)(float x, float y);
|
float (CDECL *nextafterf)(float x, float y);
|
||||||
double (CDECL *nexttoward)(double x, double y);
|
double (CDECL *nexttoward)(double x, double y);
|
||||||
|
|
|
@ -501,9 +501,6 @@
|
||||||
/* Define if MTLDevice protocol has registryID property. */
|
/* Define if MTLDevice protocol has registryID property. */
|
||||||
#undef HAVE_MTLDEVICE_REGISTRYID
|
#undef HAVE_MTLDEVICE_REGISTRYID
|
||||||
|
|
||||||
/* Define to 1 if you have the `nearbyint' function. */
|
|
||||||
#undef HAVE_NEARBYINT
|
|
||||||
|
|
||||||
/* Define to 1 if you have the <netdb.h> header file. */
|
/* Define to 1 if you have the <netdb.h> header file. */
|
||||||
#undef HAVE_NETDB_H
|
#undef HAVE_NETDB_H
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue