Improved FloatUtil.ToString to use G7 where possible while preserving exact values

This commit is contained in:
dexy 2022-01-30 23:52:14 +11:00
parent b65d250774
commit 4e1b31d957

View File

@ -123,6 +123,9 @@ namespace CodeWalker
public static string ToString(float f)
{
var c = CultureInfo.InvariantCulture;
var s = f.ToString(c);
var t = Parse(s);
if (t == f) return s;
return f.ToString("G9", c);
}