Value was 10.0 when the loop ended
value
starts out at 0.0, and has 0.1 added to it until
it reaches exactly 9.9. This is < limit
, so (ideally) the loop would execute one more time
to make value
10.0 .
The loop then would exit.
But the variable actually ends up as
10.09999999999998
because of floating point inaccuracy.
Single precision floating point is really not very accurate. But even double precision floating point has errors. If you are not cautious with floats, your program may go belly up.
What action is usually performed at the bottom of a counting loop?