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
39
tests/fixtures/numfmt/gnutest_si_input.txt
vendored
Normal file
39
tests/fixtures/numfmt/gnutest_si_input.txt
vendored
Normal file
|
@ -0,0 +1,39 @@
|
|||
-1001
|
||||
-999.1
|
||||
-999
|
||||
1
|
||||
500
|
||||
999
|
||||
999.1
|
||||
1000
|
||||
1000.1
|
||||
1001
|
||||
9900
|
||||
9901
|
||||
9949
|
||||
9950
|
||||
9951
|
||||
10000
|
||||
10001
|
||||
10500
|
||||
10999
|
||||
50000
|
||||
99000
|
||||
99001
|
||||
99900
|
||||
99949
|
||||
99950
|
||||
100000
|
||||
100001
|
||||
100999
|
||||
101000
|
||||
101001
|
||||
999000
|
||||
999001
|
||||
999949
|
||||
999950
|
||||
999999
|
||||
1000000
|
||||
1000001
|
||||
999000000.1
|
||||
999000001
|
Loading…
Add table
Add a link
Reference in a new issue