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 9 typedef int (__cdecl *fUserMathErr)(struct _exception *); 10 static fUserMathErr stUserMathErr; 11 __mingw_raise_matherr(int typ,const char * name,double a1,double a2,double rslt)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 __mingw_setusermatherr(int (__cdecl * f)(struct _exception *))28void __mingw_setusermatherr (int (__cdecl *f)(struct _exception *)) 29 { 30 stUserMathErr = f; 31 __setusermatherr (f); 32 } 33