[hackers] [sbase] sort: Use regular `double` for -n || Michael Forney

From: <git_AT_suckless.org>
Date: Wed, 13 Mar 2019 20:03:18 +0100 (CET)

commit 6b950e436b9d81edb982d740d02198ba184402fb
Author: Michael Forney <mforney_AT_mforney.org>
AuthorDate: Fri Feb 22 14:26:39 2019 -0800
Commit: Michael Forney <mforney_AT_mforney.org>
CommitDate: Wed Mar 13 11:59:33 2019 -0700

    sort: Use regular `double` for -n
    
    `long double` may require software emulation and the (possible) extra
    precision is unnecessary here.

diff --git a/sort.c b/sort.c
index 623b81e..9706e8f 100644
--- a/sort.c
+++ b/sort.c
_AT_@ -177,7 +177,7 @@ static int
 slinecmp(struct line *a, struct line *b)
 {
         int res = 0;
- long double x, y;
+ double x, y;
         struct keydef *kd;
 
         TAILQ_FOREACH(kd, &kdhead, entry) {
_AT_@ -190,8 +190,8 @@ slinecmp(struct line *a, struct line *b)
                     TAILQ_LAST(&kdhead, kdhead) != TAILQ_FIRST(&kdhead)) {
                         res = 0;
                 } else if (kd->flags & MOD_N) {
- x = strtold(col1.line.data, NULL);
- y = strtold(col2.line.data, NULL);
+ x = strtod(col1.line.data, NULL);
+ y = strtod(col2.line.data, NULL);
                         res = (x < y) ? -1 : (x > y);
                 } else if (kd->flags & (MOD_D | MOD_F | MOD_I)) {
                         res = skipmodcmp(&col1.line, &col2.line, kd->flags);
Received on Wed Mar 13 2019 - 20:03:18 CET

This archive was generated by hypermail 2.3.0 : Wed Mar 13 2019 - 20:12:23 CET