1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 14:48:14 +00:00

AK: Allow %m.nf specifier for double/float in printf to set fraction with

This patch adds the missing part for the printf of double values to specify
the length of the fraction part. For GVariant, a default of %.2 is used.
This commit is contained in:
Emanuel Sprung 2020-04-06 23:27:15 +02:00 committed by Andreas Kling
parent 22f20cd51d
commit 154dcd1ed6
2 changed files with 20 additions and 10 deletions

View file

@ -398,7 +398,7 @@ String Variant::to_string() const
case Type::UnsignedInt:
return String::number(as_uint());
case Type::Float:
return String::format("%f", (double)as_float());
return String::format("%.2f", (double)as_float());
case Type::String:
return as_string();
case Type::Bitmap: