diff --git a/configure b/configure index 3feca3f0f88..783332b5ab6 100755 --- a/configure +++ b/configure @@ -17130,6 +17130,8 @@ for ac_func in \ lrintf \ lround \ lroundf \ + nearbyint \ + nearbyintf \ powl \ remainder \ remainderf \ diff --git a/configure.ac b/configure.ac index 1c42e2de4fb..353f27163c4 100644 --- a/configure.ac +++ b/configure.ac @@ -2554,6 +2554,8 @@ AC_CHECK_FUNCS(\ lrintf \ lround \ lroundf \ + nearbyint \ + nearbyintf \ powl \ remainder \ remainderf \ diff --git a/dlls/api-ms-win-crt-math-l1-1-0/api-ms-win-crt-math-l1-1-0.spec b/dlls/api-ms-win-crt-math-l1-1-0/api-ms-win-crt-math-l1-1-0.spec index f886b976c3e..87937eae759 100644 --- a/dlls/api-ms-win-crt-math-l1-1-0/api-ms-win-crt-math-l1-1-0.spec +++ b/dlls/api-ms-win-crt-math-l1-1-0/api-ms-win-crt-math-l1-1-0.spec @@ -291,9 +291,9 @@ @ stub nan @ stub nanf @ stub nanl -@ stub nearbyint -@ stub nearbyintf -@ stub nearbyintl +@ cdecl nearbyint(double) ucrtbase.nearbyint +@ cdecl nearbyintf(float) ucrtbase.nearbyintf +@ cdecl nearbyintl(double) ucrtbase.nearbyintl @ cdecl nextafter(double double) ucrtbase.nextafter @ cdecl nextafterf(float float) ucrtbase.nextafterf @ cdecl nextafterl(double double) ucrtbase.nextafterl diff --git a/dlls/msvcr120/msvcr120.spec b/dlls/msvcr120/msvcr120.spec index 7ce5dfb3446..f3050627b81 100644 --- a/dlls/msvcr120/msvcr120.spec +++ b/dlls/msvcr120/msvcr120.spec @@ -2296,9 +2296,9 @@ @ stub nan @ stub nanf @ stub nanl -@ stub nearbyint -@ stub nearbyintf -@ stub nearbyintl +@ cdecl nearbyint(double) MSVCRT_nearbyint +@ cdecl nearbyintf(float) MSVCRT_nearbyintf +@ cdecl nearbyintl(double) MSVCRT_nearbyint @ cdecl nextafter(double double) MSVCRT__nextafter @ cdecl nextafterf(float float) MSVCRT__nextafterf @ cdecl nextafterl(double double) MSVCRT__nextafter diff --git a/dlls/msvcr120_app/msvcr120_app.spec b/dlls/msvcr120_app/msvcr120_app.spec index 1acaf7c2990..449e8e11c50 100644 --- a/dlls/msvcr120_app/msvcr120_app.spec +++ b/dlls/msvcr120_app/msvcr120_app.spec @@ -1959,9 +1959,9 @@ @ stub nan @ stub nanf @ stub nanl -@ stub nearbyint -@ stub nearbyintf -@ stub nearbyintl +@ cdecl nearbyint(double) msvcr120.nearbyint +@ cdecl nearbyintf(float) msvcr120.nearbyintf +@ cdecl nearbyintl(double) msvcr120.nearbyintl @ cdecl nextafter(double double) msvcr120.nextafter @ cdecl nextafterf(float float) msvcr120.nextafterf @ cdecl nextafterl(double double) msvcr120.nextafterl diff --git a/dlls/msvcrt/math.c b/dlls/msvcrt/math.c index e87151a701e..6880d6ce0ab 100644 --- a/dlls/msvcrt/math.c +++ b/dlls/msvcrt/math.c @@ -1353,6 +1353,30 @@ double CDECL MSVCRT__yn(int order, double num) return retval; } +/********************************************************************* + * _nearbyint (MSVCRT.@) + */ +double CDECL MSVCRT_nearbyint(double num) +{ +#ifdef HAVE_NEARBYINT + return nearbyint(num); +#else + return num >= 0 ? floor(num + 0.5) : ceil(num - 0.5); +#endif +} + +/********************************************************************* + * _nearbyintf (MSVCRT.@) + */ +float CDECL MSVCRT_nearbyintf(float num) +{ +#ifdef HAVE_NEARBYINTF + return nearbyintf(num); +#else + return MSVCRT_nearbyint(num); +#endif +} + /********************************************************************* * _nextafter (MSVCRT.@) */ diff --git a/dlls/ucrtbase/ucrtbase.spec b/dlls/ucrtbase/ucrtbase.spec index 2aa05635b1f..00058505c76 100644 --- a/dlls/ucrtbase/ucrtbase.spec +++ b/dlls/ucrtbase/ucrtbase.spec @@ -2432,9 +2432,9 @@ @ stub nan @ stub nanf @ stub nanl -@ stub nearbyint -@ stub nearbyintf -@ stub nearbyintl +@ cdecl nearbyint(double) MSVCRT_nearbyint +@ cdecl nearbyintf(float) MSVCRT_nearbyintf +@ cdecl nearbyintl(double) MSVCRT_nearbyint @ cdecl nextafter(double double) MSVCRT__nextafter @ cdecl nextafterf(float float) MSVCRT__nextafterf @ cdecl nextafterl(double double) MSVCRT__nextafter diff --git a/include/config.h.in b/include/config.h.in index 40909fe13b2..5dcd90b1813 100644 --- a/include/config.h.in +++ b/include/config.h.in @@ -564,6 +564,12 @@ /* Define to 1 if you have the header file. */ #undef HAVE_NCURSES_H +/* Define to 1 if you have the `nearbyint' function. */ +#undef HAVE_NEARBYINT + +/* Define to 1 if you have the `nearbyintf' function. */ +#undef HAVE_NEARBYINTF + /* Define to 1 if you have the header file. */ #undef HAVE_NETDB_H diff --git a/include/msvcrt/math.h b/include/msvcrt/math.h index c76fe0dffc9..5b42b4da2b4 100644 --- a/include/msvcrt/math.h +++ b/include/msvcrt/math.h @@ -148,6 +148,9 @@ float __cdecl fmodf(float, float); #define ldexpf(x,y) ((float)ldexp((double)(x),(y))) +double __cdecl nearbyint(double); +float __cdecl nearbyintf(float); + float __cdecl _hypotf(float, float); int __cdecl _matherr(struct _exception*);