From 0ef1790f618ce111eb54379ca72178ea1890879f 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 --- configure.ac | 2 + .../api-ms-win-crt-math-l1-1-0.spec | 6 +-- dlls/msvcr120/msvcr120.spec | 6 +-- dlls/msvcr120/tests/msvcr120.c | 49 ++++++++++++++++++++++ dlls/msvcr120_app/msvcr120_app.spec | 6 +-- dlls/msvcrt/math.c | 48 +++++++++++++++++++++ dlls/ucrtbase/ucrtbase.spec | 6 +-- include/config.h.in | 6 +++ 8 files changed, 117 insertions(+), 12 deletions(-) diff --git a/configure.ac b/configure.ac index 20478df..6189aa9 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 2809b66..f752c83 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 58d04e1..ad9749a 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 54c86c6..1981f9c 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,46 @@ static void test__strtof(void) p_setlocale(LC_ALL, "C"); } +static void test_remainder(void) +{ + struct { + double x, y, r; + errno_t e32, e64; + } tests[] = { + { 3.0, 2.0, -1.0, -1, -1 }, + { 1.0, 1.0, 0.0, -1, -1 }, + { INFINITY, 0.0, NAN, EDOM, EDOM }, + { INFINITY, 42.0, NAN, EDOM, EDOM }, + { NAN, 0.0, NAN, -1, EDOM }, + { NAN, 42.0, NAN, -1, EDOM }, + { 0.0, INFINITY, 0.0, -1, -1 }, + { 42.0, INFINITY, 42.0, -1, -1 }, + { 0.0, NAN, NAN, -1, EDOM }, + { 42.0, NAN, NAN, -1, EDOM }, + { 1.0, 0.0, NAN, EDOM, EDOM }, + { INFINITY, INFINITY, NAN, EDOM, EDOM }, + }; + errno_t e; + double r; + int i; + + for(i=0; i