[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#6020: coreutils-8.x: a simple feature enhancement, and how to do it
From: |
Paul Eggert |
Subject: |
bug#6020: coreutils-8.x: a simple feature enhancement, and how to do it |
Date: |
Fri, 30 Apr 2010 11:57:30 -0700 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) |
"Nelson H. F. Beebe" <address@hidden> writes:
> Because using double instead of long double cripples sorting of
> numerical data by drastically reducing the number range, I would much
> rather pay a premium in run time to get the right answer, rather than
> a useless wrong answer as GNU sort currently does.
Yes, that's right. But my note was not about that. It was about
improving performance while not affecting behavior. If all we have is
strtod, there's no point doing a long-double compare.
> -g, --general-numeric-sort compare according to general numerical
> value in type double
> -gg same as before, but with type long double
> -ggg same as before, but with general multiple-precision floating
> arithmetic using the gmp library
Even better, just compare the numbers as text, without converting them
to internal format. This is already done for -n, and would be much
faster than any of the above approaches. If done right it would be just
as accurate as gmp. (It wouldn't be trivial, though.)