Delphi / Object Pascal · Exception

EIntOverflow Exception

What does EIntOverflow Exception mean in Delphi / Object Pascal?

Raised when an integer arithmetic operation produces a result too large to fit the register/type used to hold it, under $Q+ overflow checking - most often multiplication or repeated addition on Integer/Int64 values that grow beyond the type's range.

EIntOverflow ExceptionDelphi (VCL) · Delphi (FireMonkey)

Condition

Raised when an integer arithmetic operation produces a result too large to fit the register/type used to hold it, under $Q+ overflow checking - most often multiplication or repeated addition on Integer/Int64 values that grow beyond the type's range.

Fix

Use a wider integer type such as Int64 for accumulators that can grow large, or Currency/Extended for money-like totals, and keep overflow checking enabled in debug builds so the bug surfaces during testing instead of silently wrapping in release.

Related exception