The FARGO_THORIN code developer's guide
 All Data Structures Files Functions Variables Typedefs Macros
fpe.c
Go to the documentation of this file.
1 /** \file fpe.c
2 
3 Contains two functions that specify how we handle floating point exceptions.
4 */
5 
6 #include "fargo.h"
7 
8 void handfpe() {
9  fprintf (stdout, "CPU #%d has been signaled with a floating point exception.\n",
10  CPU_Rank);
11  fprintf (stdout, "Run is aborted.\n");
12  prs_exit (1);
13 }
14 
15 void setfpe () {
16 #ifdef _TRAP_FPE
17  feenableexcept (FE_DIVBYZERO | FE_INVALID);
18  /* Can also be any of the value below:
19  FE_INEXACT inexact result
20  FE_DIVBYZERO division by zero
21  FE_UNDERFLOW result not representable due to underflow
22  FE_OVERFLOW result not representable due to overflow
23  FE_INVALID invalid operation
24  FE_ALL_EXCEPT bitwise OR of all supported exceptions
25  */
26  signal (SIGFPE, handfpe);
27 #endif
28 }
29 
void handfpe()
Definition: fpe.c:8
void setfpe()
Definition: fpe.c:15
Contains all the include directives requested by the code.
int CPU_Rank
Definition: global.h:1
void prs_exit(int numb)
Definition: LowTasks.c:33