According to the documentation :
When precision specifier controls the number of fractional digits in the result string, the result string reflects a number that is rounded to a representable result nearest to the infinitely precise result. If there are two equally near representable results:
On .NET Framework and .NET Core up to .NET Core 2.0, the runtime selects the result with the greater least significant digit (that is, using MidpointRounding.AwayFromZero).
On .NET Core 2.1 and later, the runtime selects the result with an even least significant digit (that is, using MidpointRounding.ToEven).
In this case, I would expect both to produce 1.584599426
.
Using .NET Framework 4.5.2 the resulting text is 1.584599426
but using .NET5, the resulting text is 1.584599425
.
My only thought is that with the .NET5 runtime, 1.584599425
is a "closer" representation but I don't know how to verify that.
Set up :
- Windows 10, x64
- Visual Studio 2019 (Community)
- .NET5 SDK Version : 5.0.300
- .NET Framework Version : 528372
Thanks.