mirror of
https://mirror.ghproxy.com/https://github.com/dexyfex/CodeWalker
synced 2024-11-22 15:02:54 +08:00
Improved FloatUtil.ToString to use G7 where possible while preserving exact values
This commit is contained in:
parent
b65d250774
commit
4e1b31d957
@ -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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user