mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-29 20:17:45 +00:00
numfmt: align format output values with GNU (#1745)
When converting to SI or IEC, produce values that align with the conventions used by GNU numfmt. - values > 10 are represented without a decimal place, so 10000 becomes 10K instead of 10.0K - when truncating, take the ceiling of the value, so 100001 becomes 101K - values < 10 are truncated to the highest tenth, so 1001 becomes 1.1K closes #1726
This commit is contained in:
parent
c06967a45a
commit
d06f91fbe2
7 changed files with 341 additions and 41 deletions
49
tests/fixtures/numfmt/gnutest_iec_result.txt
vendored
Normal file
49
tests/fixtures/numfmt/gnutest_iec_result.txt
vendored
Normal file
|
@ -0,0 +1,49 @@
|
|||
-1.1K
|
||||
-1.1K
|
||||
-1.0K
|
||||
-1.0K
|
||||
-1023
|
||||
0
|
||||
1
|
||||
1023
|
||||
1.0K
|
||||
1.1K
|
||||
1.1K
|
||||
1.2K
|
||||
1.5K
|
||||
1.6K
|
||||
1.9K
|
||||
2.0K
|
||||
2.0K
|
||||
2.0K
|
||||
2.0K
|
||||
2.1K
|
||||
10K
|
||||
10K
|
||||
10K
|
||||
100K
|
||||
100K
|
||||
100K
|
||||
949K
|
||||
950K
|
||||
950K
|
||||
951K
|
||||
951K
|
||||
952K
|
||||
990K
|
||||
991K
|
||||
995K
|
||||
995K
|
||||
996K
|
||||
996K
|
||||
997K
|
||||
999K
|
||||
1000K
|
||||
1023K
|
||||
1.0M
|
||||
1.0M
|
||||
1.0M
|
||||
1.1M
|
||||
1.0G
|
||||
1.0G
|
||||
1.1G
|
Loading…
Add table
Add a link
Reference in a new issue