mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-05-05 06:32:30 +02: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:
committed by
Andreas Kling
parent
22f20cd51d
commit
154dcd1ed6
Notes:
sideshowbarker
2024-07-19 07:50:18 +09:00
Author: https://github.com/lnzero1dev Commit: https://github.com/SerenityOS/serenity/commit/154dcd1ed61 Pull-request: https://github.com/SerenityOS/serenity/pull/1677 Issue: https://github.com/SerenityOS/serenity/issues/1674
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user