I have a double called int_step which i'm increasing every loop and expect to end when I have reached 1. However it iterates too much as rounding throws in some unexpected behaviour.
For some reason the following code adds quite nicely, but close to 1 i get an offset:
int_step += 0.01;
// TODO : Fix rounding step in double with step increase of + 0.01, provides error because value will become 1.000000007
if (int_step >= 1)
int_step = 1;
Can anyone explain why this happens and what the correct way is to solve this?