[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
trapping SIGFPE
From: |
Peter Jay Salzman |
Subject: |
trapping SIGFPE |
Date: |
Wed, 13 Mar 2002 12:14:13 -0800 |
User-agent: |
Mutt/1.3.27i |
dear all,
i can't seem to trap any kind of floating point exception:
#include <stdio.h>
#include <signal.h>
static void Exception(int signum);
int main(void)
{
float bignum = 9E350;
float smallnum = 9E-350;
signal(SIGFPE, Exception);
printf("%p\n", sigreturn);
printf("%Lf\n", 2.0L / 0.0L);
printf("%Le\n", bignum / smallnum);
return 0;
}
void Exception(int signum)
{
printf("Caught SIGFPE: %d.\n", signum);
exit(0);
}
SIGFPE isn't being caught, even though (i believe) i correctly installed
a signal handler.
what's going on here? how would i modify this program to catch an
overflow, underflow or divide by zero?
pete
- trapping SIGFPE,
Peter Jay Salzman <=