From d012134d232300a6aa05bc5a4b7fcd16ca11df08 Mon Sep 17 00:00:00 2001 From: Kurt Date: Sun, 16 Oct 2022 18:36:33 -0700 Subject: [PATCH] Improve display precision of size floats Use the Round-trip format when converting to string. https://learn.microsoft.com/en-us/dotnet/standard/base-types/standard-numeric-format-strings#RFormatString The default behavior in net4.~ ToString doesn't use "R", hence me assuming F6 would be sufficient, but it does not display as a round-trip value. netcore3+ changed the default behavior and aligned it with standards ~ https://devblogs.microsoft.com/dotnet/floating-point-parsing-and-formatting-improvements-in-net-core-3-0/ now, both net461 and net6 builds display the same values. Doesn't resolve the mono issue where legality check flags calc != stored. --- PKHeX.WinForms/Controls/PKM Editor/SizeCP.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/PKHeX.WinForms/Controls/PKM Editor/SizeCP.cs b/PKHeX.WinForms/Controls/PKM Editor/SizeCP.cs index dbd8060e9..3b2ed488b 100644 --- a/PKHeX.WinForms/Controls/PKM Editor/SizeCP.cs +++ b/PKHeX.WinForms/Controls/PKM Editor/SizeCP.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Globalization; using System.Windows.Forms; using PKHeX.Core; @@ -48,7 +48,7 @@ private void ResetCalculatedStats() pk?.ResetCP(); } - private static string GetString(float value) => value.ToString("F6", CultureInfo.InvariantCulture); + private static string GetString(float value) => value.ToString("R", CultureInfo.InvariantCulture); private void LoadStoredValues() {