Commit 2833a10b authored by Piotr Caban's avatar Piotr Caban Committed by Alexandre Julliard

ucrtbase: Support overriding return value in _matherr.

parent 47a5de34
...@@ -575,6 +575,9 @@ static struct _exception exception; ...@@ -575,6 +575,9 @@ static struct _exception exception;
static int CDECL matherr_callback(struct _exception *e) static int CDECL matherr_callback(struct _exception *e)
{ {
exception = *e; exception = *e;
if (!strcmp(e->name, "acos") && e->arg1 == 2)
e->retval = -1;
return 0; return 0;
} }
...@@ -748,6 +751,7 @@ static void test_math_errors(void) ...@@ -748,6 +751,7 @@ static void test_math_errors(void)
double (CDECL *p_func3d)(double, double, double); double (CDECL *p_func3d)(double, double, double);
double (CDECL *p_funcdl)(double, long); double (CDECL *p_funcdl)(double, long);
HMODULE module; HMODULE module;
double d;
int i; int i;
__setusermatherr(matherr_callback); __setusermatherr(matherr_callback);
...@@ -817,6 +821,9 @@ static void test_math_errors(void) ...@@ -817,6 +821,9 @@ static void test_math_errors(void)
ok(exception.arg2 == testsdl[i].b, ok(exception.arg2 == testsdl[i].b,
"%s(%f, %ld) got exception arg2 %f\n", testsdl[i].func, testsdl[i].a, testsdl[i].b, exception.arg2); "%s(%f, %ld) got exception arg2 %f\n", testsdl[i].func, testsdl[i].a, testsdl[i].b, exception.arg2);
} }
d = acos(2.0);
ok(d == -1.0, "failed to change log10 return value: %e\n", d);
} }
static void test_asctime(void) static void test_asctime(void)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment