2007-03-14 20:24:57 +00:00
|
|
|
#include <precomp.h>
|
2008-06-06 17:49:24 +00:00
|
|
|
|
|
|
|
#define __USE_ISOC9X 1
|
|
|
|
#define __USE_ISOC99 1
|
2007-03-14 20:24:57 +00:00
|
|
|
#include <math.h>
|
|
|
|
|
2008-06-06 17:49:24 +00:00
|
|
|
#ifdef HAVE_IEEEFP_H
|
|
|
|
#include <ieeefp.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef HAVE_FINITE
|
|
|
|
#ifndef finite /* Could be a macro */
|
|
|
|
#ifdef isfinite
|
|
|
|
#define finite(x) isfinite(x)
|
|
|
|
#else
|
|
|
|
#define finite(x) (!isnan(x)) /* At least catch some cases */
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef signbit
|
|
|
|
#define signbit(x) 0
|
|
|
|
#endif
|
|
|
|
|
|
|
|
typedef int (*MSVCRT_matherr_func)(struct _exception *);
|
|
|
|
|
|
|
|
static MSVCRT_matherr_func MSVCRT_default_matherr_func = NULL;
|
2007-03-14 20:24:57 +00:00
|
|
|
|
2008-06-06 17:49:24 +00:00
|
|
|
int CDECL _matherr(struct _exception *e)
|
2007-03-14 20:24:57 +00:00
|
|
|
{
|
2008-06-06 17:49:24 +00:00
|
|
|
if (e)
|
|
|
|
TRACE("(%p = %d, %s, %g %g %g)\n",e, e->type, e->name, e->arg1, e->arg2,
|
|
|
|
e->retval);
|
|
|
|
else
|
|
|
|
TRACE("(null)\n");
|
|
|
|
if (MSVCRT_default_matherr_func)
|
|
|
|
return MSVCRT_default_matherr_func(e);
|
|
|
|
ERR(":Unhandled math error!\n");
|
|
|
|
return 0;
|
2007-03-14 20:24:57 +00:00
|
|
|
}
|
|
|
|
|
2008-06-06 17:49:24 +00:00
|
|
|
/*********************************************************************
|
|
|
|
* __setusermatherr (MSVCRT.@)
|
2007-03-14 20:24:57 +00:00
|
|
|
*/
|
2008-06-06 17:49:24 +00:00
|
|
|
void CDECL __setusermatherr(MSVCRT_matherr_func func)
|
2007-03-14 20:24:57 +00:00
|
|
|
{
|
2008-06-06 17:49:24 +00:00
|
|
|
MSVCRT_default_matherr_func = func;
|
|
|
|
TRACE(":new matherr handler %p\n", func);
|
2007-03-14 20:24:57 +00:00
|
|
|
}
|