From d9a0c55e7eb6ea9cb822260decef4a49d425c6a0 Mon Sep 17 00:00:00 2001 From: Daniel Lehman Date: Tue, 5 Apr 2016 12:53:12 -0700 Subject: [PATCH] msvcr120: Add remainder. Signed-off-by: Daniel Lehman Signed-off-by: Piotr Caban Signed-off-by: Alexandre Julliard --- configure | 2 + configure.ac | 2 + .../api-ms-win-crt-math-l1-1-0.spec | 6 +-- dlls/msvcr120/msvcr120.spec | 6 +-- dlls/msvcr120/tests/msvcr120.c | 48 +++++++++++++++++++ dlls/msvcr120_app/msvcr120_app.spec | 6 +-- dlls/msvcrt/math.c | 40 ++++++++++++++++ dlls/ucrtbase/ucrtbase.spec | 6 +-- include/config.h.in | 6 +++ 9 files changed, 110 insertions(+), 12 deletions(-) diff --git a/configure b/configure index 0547967ce79..223d5c676e7 100755 --- a/configure +++ b/configure @@ -16876,6 +16876,8 @@ for ac_func in \ lrintf \ lround \ lroundf \ + remainder \ + remainderf \ rint \ rintf \ round \ diff --git a/configure.ac b/configure.ac index 20478dff8a9..6189aa99c73 100644 --- a/configure.ac +++ b/configure.ac @@ -2534,6 +2534,8 @@ AC_CHECK_FUNCS(\ lrintf \ lround \ lroundf \ + remainder \ + remainderf \ rint \ rintf \ round \ 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 2809b66c787..f752c83188d 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 @@ -304,9 +304,9 @@ @ stub norml @ cdecl pow(double double) ucrtbase.pow @ cdecl -arch=arm,x86_64 powf(float float) ucrtbase.powf -@ stub remainder -@ stub remainderf -@ stub remainderl +@ cdecl remainder(double double) ucrtbase.remainder +@ cdecl remainderf(float float) ucrtbase.remainderf +@ cdecl remainderl(double double) ucrtbase.remainderl @ stub remquo @ stub remquof @ stub remquol diff --git a/dlls/msvcr120/msvcr120.spec b/dlls/msvcr120/msvcr120.spec index 58d04e135c8..ad9749a0328 100644 --- a/dlls/msvcr120/msvcr120.spec +++ b/dlls/msvcr120/msvcr120.spec @@ -2324,9 +2324,9 @@ @ cdecl rand() MSVCRT_rand @ cdecl rand_s(ptr) MSVCRT_rand_s @ cdecl realloc(ptr long) MSVCRT_realloc -@ stub remainder -@ stub remainderf -@ stub remainderl +@ cdecl remainder(double double) MSVCR120_remainder +@ cdecl remainderf(float float) MSVCR120_remainderf +@ cdecl remainderl(double double) MSVCR120_remainderl @ cdecl remove(str) MSVCRT_remove @ stub remquo @ stub remquof diff --git a/dlls/msvcr120/tests/msvcr120.c b/dlls/msvcr120/tests/msvcr120.c index 54c86c60b73..e2671116da5 100644 --- a/dlls/msvcr120/tests/msvcr120.c +++ b/dlls/msvcr120/tests/msvcr120.c @@ -88,6 +88,12 @@ static void (CDECL *p_free)(void*); static float (CDECL *p_strtof)(const char *, char **); static int (CDECL *p__finite)(double); static float (CDECL *p_wcstof)(const wchar_t*, wchar_t**); +static double (CDECL *p_remainder)(double, double); +static int* (CDECL *p_errno)(void); + +/* make sure we use the correct errno */ +#undef errno +#define errno (*p_errno()) static BOOL init(void) { @@ -113,6 +119,8 @@ static BOOL init(void) p_strtof = (void*)GetProcAddress(module, "strtof"); p__finite = (void*)GetProcAddress(module, "_finite"); p_wcstof = (void*)GetProcAddress(module, "wcstof"); + p_remainder = (void*)GetProcAddress(module, "remainder"); + p_errno = (void*)GetProcAddress(module, "_errno"); return TRUE; } @@ -389,6 +397,45 @@ static void test__strtof(void) p_setlocale(LC_ALL, "C"); } +static void test_remainder(void) +{ + struct { + double x, y, r; + errno_t e; + } tests[] = { + { 3.0, 2.0, -1.0, -1 }, + { 1.0, 1.0, 0.0, -1 }, + { INFINITY, 0.0, NAN, EDOM }, + { INFINITY, 42.0, NAN, EDOM }, + { NAN, 0.0, NAN, EDOM }, + { NAN, 42.0, NAN, EDOM }, + { 0.0, INFINITY, 0.0, -1 }, + { 42.0, INFINITY, 42.0, -1 }, + { 0.0, NAN, NAN, EDOM }, + { 42.0, NAN, NAN, EDOM }, + { 1.0, 0.0, NAN, EDOM }, + { INFINITY, INFINITY, NAN, EDOM }, + }; + errno_t e; + double r; + int i; + + if(sizeof(void*) != 8) /* errno handling slightly different on 32-bit */ + return; + + for(i=0; i