When using a floating-point for
loop counter, an accumulation of rounding errors may result in a mismatch between the expected and
actual number of iterations.
Even if floating-point loop counters appears to behave correctly on one implementation, it may give a different number of iterations on another
implementation.
Noncompliant code example
for (float counter = 0.0f; counter < 1.0f; counter += 0.001f) {
...
}
Compliant solution
for (int counter = 0; counter < 1000; ++counter) {
...
}