Skip to content
The Signal Belfry

/static/campanario/en/sino/sigfpe/

Menu

SIG-012 · Program faults

SIGFPE

The “floating-point” exception that is almost never about floating point.

The name — floating-point exception — has aged badly: dividing a float by zero doesn't even ring this bell, because IEEE 754 quietly returns infinity. What rings it is integer division by zero — and the corner case INT_MIN / -1, whose result doesn't fit the type.

The name survives out of historical loyalty: on the machines of the seventies, the arithmetic unit was the loudest objector. The signal's record (siginfo) still distinguishes the subtypes — FPE_INTDIV, FPE_FLTOVF — for whoever catches it and wants the exact reason.

$ ./divide 10 0
Floating point exception (core dumped)
$ echo $?
136
(136 = 128 + 8: the shell records which bell rang)
Integer division by zero, under a floating-point name.