On 04/23/2010 08:49 PM, reg(a)dwf.com wrote:
There must be a handler for ieee arithmetic errors under Linux for C
and for
Fortran,
but my search with man and google don't turn up anything.
Can someone point me at the correct subroutine names.
See fgetenv(3).
Here's an example for C.
Andrew.
#define _GNU_SOURCE
#include <signal.h>
#include <stdio.h>
#include <math.h>
#include <fenv.h>
#include <stdlib.h>
static void
sigfpe_handler(int signo)
{
fprintf (stderr, "%s\n", __FUNCTION__);
exit (1);
}
void
main()
{
signal (SIGFPE, sigfpe_handler);
feenableexcept (FE_NOMASK_ENV);
fprintf (stderr, "%g\n", 0.0e0/0.0e0);
}