Skip to content

Commit 664e867

Browse files
authored
Made float rounding much more robust
1 parent e0a1dde commit 664e867

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

Assets/Examples/DefaultNodes/Nodes/FloatToStringNode.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,7 @@ public string GetConversionOutput()
2828

2929
protected override void Process()
3030
{
31-
var mult = Mathf.Pow(10, decimalPlaces);
32-
float val = Mathf.Round(input * mult) / mult;
31+
output = input.ToString("F" + decimalPlace, CultureInfo.InvariantCulture);
3332
output = val.ToString(CultureInfo.InvariantCulture);
3433
}
35-
}
34+
}

0 commit comments

Comments
 (0)