float a = 20000115;
cout << a;
in debug , variable window is 20000116. why? how to fix this bug?
enter image description here like this image
float a = 20000115;
cout << a;
in debug , variable window is 20000116. why? how to fix this bug?
enter image description here like this image
This is called precision loss. It's not a bug. Use double
instead of float
, it will solve the issue.