mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 15:37:46 +00:00
AK: Fix formatting of negative whole fixed point numbers
Instead of `-2` we were printing `-2.1` Co-Authored-By: Daniel Bertalan <dani@danielbertalan.dev>
This commit is contained in:
parent
daacc5c6c2
commit
394529b7d0
2 changed files with 5 additions and 1 deletions
|
@ -396,7 +396,7 @@ ErrorOr<void> FormatBuilder::put_fixed_point(
|
|||
u64 scale = pow<u64>(10, precision);
|
||||
|
||||
auto fraction = (scale * fraction_value) / fraction_one; // TODO: overflows
|
||||
if (is_negative)
|
||||
if (is_negative && fraction != 0)
|
||||
fraction = scale - fraction;
|
||||
|
||||
size_t leading_zeroes = 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue