|
From: | Linda Walsh |
Subject: | bug#21000: coreutils 8.24 sort -h gets ordering wrong |
Date: | Wed, 15 Jul 2015 11:12:29 -0700 |
User-agent: | Thunderbird |
Paul Eggert wrote:
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.
--- It has to. It's rounding to 2-3 digits.
[Prev in Thread] | Current Thread | [Next in Thread] |