Delphi / Object Pascal · Exception

EUnderflow Exception

What does EUnderflow Exception mean in Delphi / Object Pascal?

Raised when a floating-point result is smaller in magnitude than the type can represent as a normal number, rounding toward zero until precision is effectively lost. It's rarer in practice than overflow since most business calculations don't approach the minimum representable magnitude.

EUnderflow ExceptionDelphi (VCL) · Delphi (FireMonkey)

Condition

Raised when a floating-point result is smaller in magnitude than the type can represent as a normal number, rounding toward zero until precision is effectively lost. It's rarer in practice than overflow since most business calculations don't approach the minimum representable magnitude.

Fix

If the calculation legitimately produces tiny values, such as probabilities multiplied many times, rescale it or work in logarithms rather than raw magnitudes; otherwise treat it as a sign an intermediate value was computed incorrectly.

Related exception