]>
Commit | Line | Data |
---|---|---|
da32329d AM |
1 | #define _GNU_SOURCE |
2 | #include <stdio.h> | |
3 | #include <stdlib.h> | |
4 | #include <fenv.h> | |
5 | ||
6 | void enable_exceptions_() | |
7 | { | |
8 | int retval; | |
9 | /* feenableexcept returns the previous exceptions that were enabled | |
10 | on success, otherwise it returns -1 | |
11 | */ | |
12 | retval=feenableexcept( FE_DIVBYZERO | FE_INVALID | FE_OVERFLOW | FE_UNDERFLOW ); | |
13 | if ( retval == -1 ) | |
14 | { | |
15 | fprintf(stderr, "Warning: call to feenableexcept() failed \n"); | |
16 | } | |
17 | } | |
18 | ||
19 | /* This second routine is for Fortran compilers such as g77 and pathf90 | |
20 | which follow the f2c name mangling style | |
21 | */ | |
22 | void enable_exceptions__() | |
23 | { | |
24 | enable_exceptions_(); | |
25 | } |