I noticed that some float variables are being shown wrong in Visual Studio 2017 debugger, although the internal value is right, that is, it is only wrong in the debug view.
For example:
obj_carro.vel1000rpm.push_back(stof(parte[2].substr(0, pos)));
cout << stof(parte[2].substr(0, pos)) << endl;
cout << obj_carro.vel1000rpm[obj_carro.vel1000rpm.size() - 1] << endl;
It shows the correct value:
9.9
9.9
But VS 2017 debugger shows:
9.89999962 float
What is wrong? How to solve this?
Update: the cout
output rounds to 6 decimal places after the point. This should be an answer, but the question is on hold...