Skip to content

Commit

Permalink
Fix leading zeroes in remainder being axed
Browse files Browse the repository at this point in the history
  • Loading branch information
Kein authored and ManlyMarco committed Sep 19, 2020
1 parent 95104b9 commit dc2884a
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions FPSCounter/Extensions/StringBuilderNumerics.cs
Original file line number Diff line number Diff line change
Expand Up @@ -161,15 +161,13 @@ public static StringBuilder Concat(this StringBuilder string_builder, float floa
float remainder = Math.Abs(float_val - int_part);

// Multiply up to become an int that we can print
do
{
remainder *= 10;
decimal_places--;
}
while (decimal_places > 0);

// All done, print that as an int!
string_builder.Concat((uint)remainder, 0, '0', 10);
do
{
remainder *= 10;
string_builder.Concat((uint)remainder % 10);
decimal_places--;
}
while (decimal_places > 0);
}
return string_builder;
}
Expand Down

0 comments on commit dc2884a

Please sign in to comment.