summaryrefslogtreecommitdiff
path: root/src/sort.c
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2010-04-30 23:23:38 +0100
committerPádraig Brady <P@draigBrady.com>2010-05-01 23:25:39 +0100
commitd861519d2a3214df2b4cd2ee6d59e8772371f780 (patch)
tree12855794fac022ad9d7674b9d34fbfede7b6161e /src/sort.c
parent5e9a7ae46b58ec8c59157b4e16c3773b1e72802b (diff)
downloadcoreutils-d861519d2a3214df2b4cd2ee6d59e8772371f780.tar.xz
sort: use long doubles only when effective
* src/sort.c (general_numcompare): Don't use long double if strtold is not available, as it may introduce needless overhead.
Diffstat (limited to 'src/sort.c')
-rw-r--r--src/sort.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/sort.c b/src/sort.c
index a81524470..54b97e22a 100644
--- a/src/sort.c
+++ b/src/sort.c
@@ -1856,15 +1856,17 @@ general_numcompare (const char *sa, const char *sb)
only if A and B can't be compared more cheaply/accurately. */
#if HAVE_C99_STRTOLD /* provided by c-strtold module. */
-# define STRTOD strtold
+# define long_double long double
#else
-# define STRTOD strtod
+# define long_double double
+# undef strtold
+# define strtold strtod
#endif
char *ea;
char *eb;
- long double a = STRTOD (sa, &ea);
- long double b = STRTOD (sb, &eb);
+ long_double a = strtold (sa, &ea);
+ long_double b = strtold (sb, &eb);
/* Put conversion errors at the start of the collating sequence. */
if (sa == ea)