Delphi / Object Pascal · Exception
What does EDivByZero Exception mean in Delphi / Object Pascal?
Raised when integer division (div or mod) is attempted with a zero divisor. Unlike floating-point division by zero, which by default produces infinity rather than raising, integer division by zero always raises this exception.
Raised when integer division (div or mod) is attempted with a zero divisor. Unlike floating-point division by zero, which by default produces infinity rather than raising, integer division by zero always raises this exception.
Check the divisor for zero before dividing, especially when it comes from a calculated value, a database aggregate, or user input, and decide explicitly what the result should be instead of letting the exception propagate.