A loop counts with a floating variable, so rounding changes how often it runs
What it finds
for (x = 0.0; x < 1.0; x += 0.1): the steps are not exact in binary, so the counter misses the bound by a little and the loop runs once more or less than it appears to. Counting with an integer and computing the floating value from it is exact.
The condition must compare a variable the file declares as float or double, and the step of the loop must change it.
From the rule's source, floating_loop_counter.rs.
Turn it on, off or suppress it
The rule runs from the recommended tier up. To turn it on in a lower tier, give it a level in tx0.toml:
[rules]
"tx0/c:floating-loop-counter" = "warning"To keep one finding, suppress it with a reason. tx0 suppress ID --reason "..." writes the comment on the line before the code:
// tx0: ignore[tx0/c:floating-loop-counter] reason="..."tx0 explain tx0/c:floating-loop-counter shows the same in the terminal. Found a false positive? Report it.