From: Daniel Lehman dlehman25@gmail.com
--- dlls/msvcr120/tests/msvcr120.c | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/dlls/msvcr120/tests/msvcr120.c b/dlls/msvcr120/tests/msvcr120.c index 5a200d5e705..bb477e2a87a 100644 --- a/dlls/msvcr120/tests/msvcr120.c +++ b/dlls/msvcr120/tests/msvcr120.c @@ -1852,6 +1852,8 @@ static void test_exp(void) ok(!matherr_called, "matherr was called for %d\n", i); } } + + __setusermatherr(NULL); }
static void test_cexp(void)
From: Daniel Lehman dlehman25@gmail.com
--- dlls/msvcr120/tests/msvcr120.c | 21 +++++++++------------ libs/musl/src/math/exp.c | 3 +++ 2 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/dlls/msvcr120/tests/msvcr120.c b/dlls/msvcr120/tests/msvcr120.c index bb477e2a87a..462d7bd11bd 100644 --- a/dlls/msvcr120/tests/msvcr120.c +++ b/dlls/msvcr120/tests/msvcr120.c @@ -1815,17 +1815,16 @@ static void test_exp(void) static const struct { double x, exp; errno_t e; - BOOL todo; } tests[] = { - { NAN, NAN, EDOM, TRUE }, - { -NAN, -NAN, EDOM, TRUE }, - { INFINITY, INFINITY }, - { -INFINITY, 0.0 }, - { 0.0, 1.0 }, - { 1.0, 2.7182818284590451 }, - { 709.7, 1.6549840276802644e+308 }, - { 709.782712893384, 1.7976931348622732e+308 }, - { 709.782712893385, INFINITY, ERANGE }, + { NAN, NAN, EDOM }, + { -NAN, -NAN, EDOM }, + { INFINITY, INFINITY }, + { -INFINITY, 0.0 }, + { 0.0, 1.0 }, + { 1.0, 2.7182818284590451 }, + { 709.7, 1.6549840276802644e+308 }, + { 709.782712893384, 1.7976931348622732e+308 }, + { 709.782712893385, INFINITY, ERANGE }, }; errno_t e; double r; @@ -1844,13 +1843,11 @@ static void test_exp(void) ok(compare_double(r, tests[i].exp, 16), "expected %0.16e, got %0.16e for %d\n", tests[i].exp, r, i); ok(signbit(r) == signbit(tests[i].exp), "expected sign %x, got %x for %d\n", signbit(tests[i].exp), signbit(r), i); - todo_wine_if(tests[i].todo) { ok(e == tests[i].e, "expected errno %i, but got %i for %d\n", tests[i].e, e, i); if (tests[i].e) ok(matherr_called, "matherr wasn't called for %d\n", i); else ok(!matherr_called, "matherr was called for %d\n", i); - } }
__setusermatherr(NULL); diff --git a/libs/musl/src/math/exp.c b/libs/musl/src/math/exp.c index 0c518a31ebd..08c4831a03f 100644 --- a/libs/musl/src/math/exp.c +++ b/libs/musl/src/math/exp.c @@ -79,6 +79,9 @@ double __cdecl __exp(double x, matherr_t matherr) uint64_t ki, idx, top, sbits; double_t kd, z, r, r2, scale, tail, tmp;
+ if (isnan(x)) + return matherr(_DOMAIN, "exp", x, 0, x); + abstop = top12(x) & 0x7ff; if (predict_false(abstop - top12(0x1p-54) >= top12(512.0) - top12(0x1p-54))) { if (abstop - top12(0x1p-54) >= 0x80000000)