#include <stdio.h>
int main()
{
float f = 1717.7890625;
printf( "%.6f", f );
return 0;
}
I compiled this code with Visual Studio 19 (16.9.2) for x64 arch and ran the result on two my Windows 10 PCs:
- Version 1909 (OS build 18363.1440) -> Debug and Release:
1717.789063 - Version 2004 (OS build 19041.867) -> Debug:
1717.789063Release:1717.789062
What is the cause of the difference between the Debug and Release results on new version? How can I fix it to make results identical on both versions?
Addition: The code:
#include <stdio.h>
int main()
{
double f = 0.25;
printf( "%.1f", f );
return 0;
}
has the same behavior on new vs old Win10 versions. I suggest, that's an error in newer ucrtbase.dll version