bug-coreutils
[Top][All Lists]
Advanced

[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: Nelson H. F. Beebe
Subject: bug#6020: coreutils-8.x: a simple feature enhancement, and how to do it
Date: Fri, 30 Apr 2010 12:36:08 -0600 (MDT)

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: address@hidden  -
- 155 S 1400 E RM 233                       address@hidden  address@hidden -
- Salt Lake City, UT 84112-0090, USA    URL: http://www.math.utah.edu/~beebe/ -
-------------------------------------------------------------------------------






reply via email to

[Prev in Thread] Current Thread [Next in Thread]