|
From: | Paul Eggert |
Subject: | bug#21000: coreutils 8.24 sort -h gets ordering wrong |
Date: | Wed, 15 Jul 2015 08:05:03 -0700 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 |
Linda Walsh wrote:
since the output is targetted for 3-4 digits+ a suffix, one would just normalize them.
If the output is that of 'du' or 'df' and has just a few digits and always uses a consistent suffix, then there is no need to normalize it; that is what 'sort' does now. In this case 'sort' doesn't need to know whether the output uses powers-of-1024 or powers-of-1000. However, if the output is from some other random program that uses suffixes inconsistently, all that goes out the window: normalization and some form of arbitrary-precision arithmetic would be required and 'sort' would need to be told whether the suffixes use powers of 1024 or powers of 1000.
I didn't understand the code snippet you sent, but it appears to have rounding errors. 'sort' doesn't have rounding errors when doing the comparison in question. Let's not introduce them now.
[Prev in Thread] | Current Thread | [Next in Thread] |