[C# Calc] Fixes: Keep the value away from getting rounded in Graphing Mode (#1596)

* keep the value away from getting rounded

* set the display precision to 6 to align with C++ impl
This commit is contained in:
Tian L 2021-06-30 14:07:30 +08:00 committed by GitHub
commit 4ae898d827
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -476,8 +476,7 @@ namespace CalculatorApp
private double validateDouble(string value, double defaultValue)
{
double resultValue = 0;
if (double.TryParse(value, out resultValue))
if (double.TryParse(value, out var resultValue))
{
return resultValue;
}
@ -544,9 +543,7 @@ namespace CalculatorApp
return;
}
// CSHARP_MIGRATION: TODO:
// Due to different culture, some regions use comma instead of dot as the decimal point
sender.Text = val.ToString("0", System.Globalization.CultureInfo.InvariantCulture);
sender.Text = val.ToString("G6", System.Globalization.CultureInfo.InvariantCulture);
}
private void VariableAreaClicked(object sender, RoutedEventArgs e)