SIGFPE signal problem
Peter C. Bahrs
pcb at gator.cacs.usl.edu
Sun Mar 18 17:52:21 AEST 1990
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 <stdio.h>
#include <signal.h>
#include <errno.h>
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 at gator.cacs.usl.edu |
| 2 Rex Street |
| University of Southwestern Louisiana ...!uunet!dalsqnt!gator!pcb |
| Lafayette, LA 70504 |
+-----------------------------------------------------------------------*/
More information about the Comp.unix.questions
mailing list