master
1/**
2 * This file has no copyright assigned and is placed in the Public Domain.
3 * This file is part of the mingw-w64 runtime package.
4 * No warranty is given; refer to the file DISCLAIMER.PD within this package.
5 */
6
7#include <math.h>
8
9typedef int (__cdecl *fUserMathErr)(struct _exception *);
10static fUserMathErr stUserMathErr;
11
12void __mingw_raise_matherr (int typ, const char *name, double a1, double a2,
13 double rslt)
14{
15 struct _exception ex;
16 if (!stUserMathErr)
17 return;
18 ex.type = typ;
19 ex.name = (char*)name;
20 ex.arg1 = a1;
21 ex.arg2 = a2;
22 ex.retval = rslt;
23 (*stUserMathErr)(&ex);
24}
25
26#undef __setusermatherr
27
28void __mingw_setusermatherr (int (__cdecl *f)(struct _exception *))
29{
30 stUserMathErr = f;
31 __setusermatherr (f);
32}