IEEE 754 - This standard defines five
types of floating-point exception that must be signaled when detected:
- Invalid operation
- Division by zero
- Overflow
- Underflow
- Inexact calculation
When one of these exceptions occurs in a user process,
it is signaled either by setting a flag or taking a trap. By default, the
system sets a status flag in the Floating-Point Status and Control registers
(FPSCR), indicating the exception has occurred. Once the status flags are
set by an exception, they are cleared only when the process clears them explicitly
or when the process ends. The operating system provides subroutines to query,
set, or clear these flags.
The system can also cause the floating-point exception
signal (SIGFPE) to be raised if a floating-point exception
occurs. Because this is not the default behavior, the operating system provides
subroutines to change the state of the process so the signal is enabled. When
a floating-point exception raises the SIGFPE signal,
the process terminates and produces a core file if no signal-handler subroutine
is present in the process. Otherwise, the process calls the signal-handler
subroutine.