mirror of
https://git.savannah.gnu.org/git/coreutils.git
synced 2026-11-17 18:02:09 +03:00
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.
This commit is contained in:
1 parent
5e9a7ae46b
commit
d861519d2a
1 file changed
+6
-4
+6
-4
@@ -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)
|
||||
|
||||
Reference in new issue
Block a user