Make accuracy formatting more consistent

This commit is contained in:
TheWildTree 2020-02-07 22:09:45 +01:00
parent 51ae741fc7
commit 8c10d31af9
1 changed files with 2 additions and 4 deletions

View File

@ -7,18 +7,16 @@ public static class FormatUtils
{
/// <summary>
/// Turns the provided accuracy into a percentage with 2 decimal places.
/// Omits all decimal places when <paramref name="accuracy"/> equals 1d.
/// </summary>
/// <param name="accuracy">The accuracy to be formatted</param>
/// <returns>formatted accuracy in percentage</returns>
public static string FormatAccuracy(this double accuracy) => accuracy == 1 ? "100%" : $"{accuracy:0.00%}";
public static string FormatAccuracy(this double accuracy) => $"{accuracy:0.00%}";
/// <summary>
/// Turns the provided accuracy into a percentage with 2 decimal places.
/// Omits all decimal places when <paramref name="accuracy"/> equals 100m.
/// </summary>
/// <param name="accuracy">The accuracy to be formatted</param>
/// <returns>formatted accuracy in percentage</returns>
public static string FormatAccuracy(this decimal accuracy) => accuracy == 100 ? "100%" : $"{accuracy:0.00}%";
public static string FormatAccuracy(this decimal accuracy) => $"{accuracy:0.00}%";
}
}