/********************************************
copyright 1991, Michael D. Brennan
This is a source file for mawk, an implementation of
the AWK programming language.
Mawk is distributed without warranty under the terms of
the GNU General Public License, version 2, 1991.
********************************************/
* Revision 1.2 1992/06/02 05:07:35 rich
* Ported to 386bsd. Changes from vax BSD4.3 include usage of
* fmod in libm.a, usage of void pointers, and usage of vfprintf
* in libc.a. Floating point exceptions are not raised when
* they should be, which causes the last fpe test to fail.
* Revision 5.1 91/12/05 07:56:18 brennan
/* machine dependent changes might be needed here */
static void fpe_catch( signal
, why
)
/* some systems give no hook to find out what the exception
was -- stuff like this is why people still use fortran
If this fits, #define NOINFO_SIGFPE 1 in your config.h
rt_error("floating point exception, probably overflow") ;
rt_error("division by zero") ;
rt_error("floating point overflow") ;
rt_error("floating point exception") ;
{ (void) signal(SIGFPE
, fpe_catch
) ; }
#else /* FPE_TRAPS_ON==0 */
/* If we are not trapping math errors, we will shutup the library calls
#else /* print error message and exit */
error
= "loss of significance" ;
return 1 ; /* ignore it */
if ( strcmp(e
->name
, "atan2") == 0 )
rt_error("atan2(%g,%g) : %s" ,
e
->arg1
, e
->arg2
, error
) ;
rt_error("%s(%g) : %s" , e
->name
, e
->arg1
, error
) ;
#endif /* HAVE_MATHERR */
/* this is how one gets the libm calls to do the right
case ERANGE
: errno
= ERANGE
; return HUGE
;
case -ERANGE
: errno
= EDOM
; return -HUGE
;
/* This routine is for XENIX-68K 2.3A.
Error check routine to be called after fp arithmetic.
/* Definitions of bit values in iserr() return value */
if ((fperrval
= iserr()) == 0)
errdesc
= "arg is infinity or NAN" ;
else if (fperrval
& ZERODIV
)
errdesc
= "division by zero" ;
else if (fperrval
& OVFLOW
)
else if (fperrval
& UFLOW
)
rt_error("%s", errdesc
) ;