GNU bug report logs -
#6020
coreutils-8.x: a simple feature enhancement, and how to do it
Previous Next
Full log
View this message in rfc822 format
Paul Eggert writes about the proposed use of long double instead of
double in sort's -g option:
>> ...
>> This could cause performance problems on machines that have slow
>> long-double operations (implemented via traps, say) and that lack
>> strtold.
>> ...
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.
If you folks want to consider alternatives, we could have something
like this:
-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
However, I'd much prefer a single option, and correct output. Most
people don't need floating-point comparisons in their sorts, but for
those of us who do, correctness trumps speed every time.
There should not be a problem in using -lgmp on modern systems,
because (a) it is very portable, and (b) it is required by all gcc-4.x
installations (and we reached the first release of the gcc-4.6 family
on 16-Apr-2010). Indeed, -lgmp has been tested for back to at least
coreutils-7.0.
-------------------------------------------------------------------------------
- Nelson H. F. Beebe Tel: +1 801 581 5254 -
- University of Utah FAX: +1 801 581 4148 -
- Department of Mathematics, 110 LCB Internet e-mail: beebe <at> math.utah.edu -
- 155 S 1400 E RM 233 beebe <at> acm.org beebe <at> computer.org -
- Salt Lake City, UT 84112-0090, USA URL: http://www.math.utah.edu/~beebe/ -
-------------------------------------------------------------------------------
This bug report was last modified 15 years and 83 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.