mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 11:07:45 +00:00
Calculator: Use format instead of printf.
This also fixes a graphical bug where the decimal point was always rendered. The number four was represented as '4.' instead of '4'. Now the decimal point is only shown when there are decimal places.
This commit is contained in:
parent
31feefff5e
commit
206e48abb5
1 changed files with 2 additions and 2 deletions
|
@ -162,10 +162,10 @@ String Keypad::to_string() const
|
||||||
StringBuilder builder;
|
StringBuilder builder;
|
||||||
if (m_negative)
|
if (m_negative)
|
||||||
builder.append("-");
|
builder.append("-");
|
||||||
builder.appendf("%ld.", m_int_value);
|
builder.appendff("{}", m_int_value);
|
||||||
|
|
||||||
if (m_frac_length > 0)
|
if (m_frac_length > 0)
|
||||||
builder.appendf("%0*ld", m_frac_length, m_frac_value);
|
builder.appendff(".{:0{}}", m_frac_value, m_frac_length);
|
||||||
|
|
||||||
return builder.to_string();
|
return builder.to_string();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue