FPE_INTOVF
| Integer overflow.
|
FPE_FLTDIV
| Floating-point divide by zero.
|
FPE_FLTOVF
| Floating-point overflow.
|
FPE_FLTUND
| Floating-point underflow.
|
FPE_FLTRES
| Floating-point inexact result.
|
FPE_FLTINV
| Invalid floating-point operation.
|
FPE_FLTSUB
| Subscript out of range.
|
SIGFPE is the symbolic signal name for the signal sent to computer programs that perform erroneous arithmetic operations on POSIX compliant platforms. SIGFPE is a symbolic constant defined in signal.h. Symbolic signal names are used as signal numbers can vary across platforms.
Etymology
SIG- is a common prefix for signal names, FPE is the Acronym of Floating Point Exception.
Description
SIGFPE is sent to processes for a variety of reasons, a common example might be an unexpected type overflow (eg, unsigned integer) due to exceptional input, or an error in a program construct.
SIGFPE can be handled, that is, programmers can specify the action they want to occur on receiving the signal, such as calling a subroutine, ignoring the event, or restoring the default action.
Note that under certain circumstances ignoring a SIGFPE can result in Nasal demons. However it is safe to ignore SIGFPE signals not generated by the operating system, such as users with the appropriate permissions to use the kill() system call.
Example
Here is an example of an ANSI C program that should attempt to perform an Erroneous Artihmetic Operation, specifically an FPE_INTDIV, or Integer Division by zero.
int main()
{
int x = 42/0;
}
Compiling and running it on IA-32 with Linux produces the following:
$ gcc -o sigfpe sigfpe.c
$ ./sigfpe
Floating point exception (core dumped)
Backtrace from gdb:
Program received signal SIGFPE, Arithmetic exception.
0x08048373 in main ()
Compare
See Also