mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-02 15:46:33 +00:00
AK: Strip trailing zero decimals in default formatting of float numbers
This gives us a more human-looking serialization of numbers by default, and in case a fixed number of decimal digits is actually wanted, we still have the 'f' specifier.
This commit is contained in:
parent
e004be7a08
commit
734bc2a0ea
Notes:
github-actions[bot]
2025-05-18 15:24:36 +00:00
Author: https://github.com/awesomekling
Commit: 734bc2a0ea
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4803
3 changed files with 51 additions and 31 deletions
|
@ -311,7 +311,8 @@ TEST_CASE(no_precision_no_trailing_number)
|
|||
|
||||
TEST_CASE(precision_with_trailing_zeros)
|
||||
{
|
||||
EXPECT_EQ(ByteString::formatted("{:0.3}", 1.12), "1.120");
|
||||
EXPECT_EQ(ByteString::formatted("{:0.3f}", 1.12), "1.120");
|
||||
EXPECT_EQ(ByteString::formatted("{:0.3}", 1.12), "1.12");
|
||||
EXPECT_EQ(ByteString::formatted("{:0.1}", 1.12), "1.1");
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue