Consider the following program
public static void Main()
{
double result = 0;
if (Double.TryParse("29.97999999999999", NumberStyles.Any, CultureInfo.InvariantCulture, out result)) {
Console.WriteLine(result);
}
}
When run in .net framework (x64) it prints 29.98 whereas in .net core it prints 29.97999999999999.
Any idea why that is? And more important, how can I force one of the frameworks to round like the other and vice-versa?