mirror of
https://mirror.ghproxy.com/https://github.com/dexyfex/CodeWalker
synced 2026-05-18 13:13:43 +08:00
Improved FloatUtil.ToString to use G7 where possible while preserving exact values
This commit is contained in:
@@ -123,6 +123,9 @@ namespace CodeWalker
|
|||||||
public static string ToString(float f)
|
public static string ToString(float f)
|
||||||
{
|
{
|
||||||
var c = CultureInfo.InvariantCulture;
|
var c = CultureInfo.InvariantCulture;
|
||||||
|
var s = f.ToString(c);
|
||||||
|
var t = Parse(s);
|
||||||
|
if (t == f) return s;
|
||||||
return f.ToString("G9", c);
|
return f.ToString("G9", c);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user