sort: Use regular double for -n

`long double` may require software emulation and the (possible) extra
precision is unnecessary here.
This commit is contained in:
Michael Forney 2019-02-22 14:26:39 -08:00
parent c30255e50a
commit 6b950e436b

6
sort.c
View File

@ -177,7 +177,7 @@ static int
slinecmp(struct line *a, struct line *b) slinecmp(struct line *a, struct line *b)
{ {
int res = 0; int res = 0;
long double x, y; double x, y;
struct keydef *kd; struct keydef *kd;
TAILQ_FOREACH(kd, &kdhead, entry) { TAILQ_FOREACH(kd, &kdhead, entry) {
@ -190,8 +190,8 @@ slinecmp(struct line *a, struct line *b)
TAILQ_LAST(&kdhead, kdhead) != TAILQ_FIRST(&kdhead)) { TAILQ_LAST(&kdhead, kdhead) != TAILQ_FIRST(&kdhead)) {
res = 0; res = 0;
} else if (kd->flags & MOD_N) { } else if (kd->flags & MOD_N) {
x = strtold(col1.line.data, NULL); x = strtod(col1.line.data, NULL);
y = strtold(col2.line.data, NULL); y = strtod(col2.line.data, NULL);
res = (x < y) ? -1 : (x > y); res = (x < y) ? -1 : (x > y);
} else if (kd->flags & (MOD_D | MOD_F | MOD_I)) { } else if (kd->flags & (MOD_D | MOD_F | MOD_I)) {
res = skipmodcmp(&col1.line, &col2.line, kd->flags); res = skipmodcmp(&col1.line, &col2.line, kd->flags);