mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 19:47: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_input.txt
vendored
Normal file
49
tests/fixtures/numfmt/gnutest_iec_input.txt
vendored
Normal file
|
@ -0,0 +1,49 @@
|
|||
-1025
|
||||
-1024.1
|
||||
-1024
|
||||
-1023.1
|
||||
-1023
|
||||
0
|
||||
1
|
||||
1023
|
||||
1024
|
||||
1025
|
||||
1126
|
||||
1127
|
||||
1536
|
||||
1537
|
||||
1945
|
||||
1946
|
||||
1996
|
||||
1997
|
||||
2048
|
||||
2049
|
||||
10188
|
||||
10189
|
||||
10240
|
||||
102348
|
||||
102349
|
||||
102400
|
||||
971776
|
||||
972288
|
||||
972800
|
||||
972801
|
||||
973824
|
||||
973825
|
||||
1013760
|
||||
1013761
|
||||
1018879
|
||||
1018880
|
||||
1018881
|
||||
1019904
|
||||
1019905
|
||||
1022976
|
||||
1022977
|
||||
1047552
|
||||
1047553
|
||||
1048575
|
||||
1048576
|
||||
1048577
|
||||
1073741823
|
||||
1073741824
|
||||
1073741825
|
Loading…
Add table
Add a link
Reference in a new issue