1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 11:20:04 +08:00

Ensure negative sign is only applied when the post-rounded result is negative

This commit is contained in:
Dean Herbert 2023-05-02 14:00:52 +09:00
parent 63890ef6fe
commit ad40099e32

View File

@ -97,7 +97,9 @@ namespace osu.Game.Graphics.UserInterface
// Find the number of significant digits (we could have less than 5 after normalize())
int significantDigits = FormatUtils.FindPrecision(decimalPrecision);
return floatValue.ToString($"N{significantDigits}");
string negativeSign = Math.Round(floatValue, significantDigits) < 0 ? "-" : string.Empty;
return $"{negativeSign}{Math.Abs(floatValue).ToString($"N{significantDigits}")}";
}
/// <summary>