Date: Thu, 14 Jan 1993 10:13 EST From: AE2Y AT VAX5 DOT CIT DOT CORNELL DOT EDU Subject: Trapping floating point exceptions To: djgpp AT sun DOT soe DOT clarkson DOT edu The following program is compiled with gcc fptest.c -Wall -lm -m486 -O and runs without printing any message about its two floating point execptions: /* this is a floating point test */ #include int main(void) { double w, x, y = 1.0, z = 0.0, t = -1.0; w = y/z ; x = log(t) ; return 0 ; } I would like to know how to: 1) trap the exceptions and stop the program as soon as one occurs, à la FORTRAN; 2) if possible at all, print the function and the line in which the exception occurred. Any suggestions will be appreciated. Nelson Luis Dias ae2y AT vax5 DOT cit DOT cornell DOT edu