Xref: utzoo comp.lang.c:27021 comp.unix.questions:20667 Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!uunet!samsung!rex!rouge!gator.cacs.usl.edu From: pcb@gator.cacs.usl.edu (Peter C. Bahrs) Newsgroups: comp.lang.c,comp.unix.questions Subject: SIGFPE signal problem Message-ID: <5450@rouge.usl.edu> Date: 18 Mar 90 07:52:21 GMT Sender: anon@rouge.usl.edu Followup-To: comp.lang.c Distribution: usa Organization: The Center for Advanced Computer Studies, USL Lines: 42 I am trying to detect overflow, 0 divide and, although it may seem unlikely, underflow. Doesn't SIGFPE detect this? If so, why doesn't the following SMALL code work? Why and how in the heck can vendors not provide for underflow detection? I am working on SUN 3,4 and Val 11780. #include #include #include void h(); main() { int i=1; float a=2.3; signal(SIGFPE,h); printf ("errno %d\n",errno); i = i / 0; a = a / 0.0; a = 999999999999999999999999999999999999999999999999999999999999999999999999999999999.9; printf ("%d %f\n",i,a); } void h() { printf ("testing...1 hour\n"); exit(1); } output: 1 inf /*----------- Thanks in advance... --------------------------------------+ | Peter C. Bahrs | | Center For Advanced Computer Studies INET: pcb@gator.cacs.usl.edu | | 2 Rex Street | | University of Southwestern Louisiana ...!uunet!dalsqnt!gator!pcb | | Lafayette, LA 70504 | +-----------------------------------------------------------------------*/