Fortran · Exception

IEEE_DIVIDE_BY_ZERO — Floating-Point Division by Zero

What does IEEE_DIVIDE_BY_ZERO — Floating-Point Division by Zero mean in Fortran?

Signals when a finite nonzero floating-point value is divided by exact zero (integer division by zero is a separate, always-fatal condition, not this flag). Without trapping, the division returns a correctly signed Infinity rather than stopping the program, which can silently corrupt downstream results.

IEEE_DIVIDE_BY_ZERO — Floating-Point Division by ZeroIntel Fortran · gfortran

Condition

Signals when a finite nonzero floating-point value is divided by exact zero (integer division by zero is a separate, always-fatal condition, not this flag). Without trapping, the division returns a correctly signed Infinity rather than stopping the program, which can silently corrupt downstream results.

Fix

Add explicit zero-denominator checks before dividing where zero is a plausible input, or turn on trapping with -ffpe-trap=zero (gfortran) or IEEE_SET_HALTING_MODE(IEEE_DIVIDE_BY_ZERO, .TRUE.) to abort immediately at the failing statement during debugging.

Related exception