I have a problem with simple while loop. This code cout 1, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8 and it ends on number 1.9 and doesn't go futher to 2. My code:
float start = 1, end = 2, delta = 0.1;
while (start <= end)
{
cout << start << endl;
start += delta;
}
In debug I see that the last number is 1.90000021. And other also has many zeros after comma. If I change type to double, I have the same error. Please, if you know, say me how to fix it? I need to destinate start=2 in while-loop.