Skip to content

pointless-integer-math

Detect floating-point helpers applied to converted integers.

Updated View as Markdown

Default severity: warning

An integer converted to floating point is already integral and finite. Rounding it with math.Ceil, math.Floor, or math.Trunc, or testing it with math.IsNaN or math.IsInf, cannot provide useful information.

Bad

rounded := math.Ceil(float64(count))

Good

rounded := math.Ceil(measurement)
Navigation

Type to search…

↑↓ navigate↵ selectEsc close