Why does the string representation of floating-point numbers change after .NET update?

  • Thread starter Thread starter Jaroslav Kazejev
  • Start date Start date
J

Jaroslav Kazejev

Guest
After Windows has updated, some calculated values have changed in the last digit, e.g. from -0.0776529085243926 to -0.0776529085243925. The change is always down by one and both even and odd numbers are affected. This seems to be related to KB4486153, as reverting this update changes the values back to the previous ones. (It may also be related to KB4512192 which was installed at the same time.)


This change can be seen already when debugging in Visual Studio and the value is later written to an output file and changes therein as well (without running the debugger).


I know about loss of precision in floating-point calculations, but why does this change happen after an update and how can we guarantee that future updates don't change the representation of values?



Minimal reproducible example


The printout below changes from -0.0776529085243926 to -0.0776529085243925 after the update.




var output = -0.07765290852439255;
Trace.WriteLine(output); // This printout changes with the update.




This question was also posted to StackOverflow

Rounding of last digit changes after Windows .NET update

Continue reading...
 
Back
Top