Delphi / Object Pascal · Exception

Runtime Error 215: EIntOverflow (arithmetic overflow)

What does Runtime Error 215: EIntOverflow (arithmetic overflow) mean in Delphi / Object Pascal?

An integer arithmetic operation produced a result too large for the destination integer type, distinct from EOverflow in that this covers integer types, not floating-point.

Runtime Error 215: EIntOverflow (arithmetic overflow)Delphi (VCL) · Delphi (FireMonkey)

Condition

An integer arithmetic operation produced a result too large for the destination integer type, distinct from EOverflow in that this covers integer types, not floating-point.

Fix

Check the destination variable's integer type range against the largest value the calculation can produce, and consider a wider type (Int64) if the legitimate range of results exceeds a 32-bit integer.

Pending source verification. Not yet checked against official documentation.

Related exception