Skip to content

zero-integer-division

Default severity: error

Dividing two integer literals uses integer arithmetic. A fraction such as 2 / 3 therefore truncates to zero, even when it is later converted or assigned to a floating-point value.

Named constants are accepted to avoid warning on deliberate integer formulas.

ratio := 2 / 3
ratio := 2.0 / 3.0