diff options
Diffstat (limited to 'src/util.c')
-rw-r--r-- | src/util.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/util.c b/src/util.c index dba7f20f9..c734b1b6d 100644 --- a/src/util.c +++ b/src/util.c @@ -521,12 +521,12 @@ int ld2string(char *buf, size_t len, long double value, int humanfriendly) { if (l+1 > len) return 0; /* No room. */ /* Now remove trailing zeroes after the '.' */ if (strchr(buf,'.') != NULL) { - char *p = buf+len-1; + char *p = buf+l-1; while(*p == '0') { p--; - len--; + l--; } - if (*p == '.') len--; + if (*p == '.') l--; } } else { l = snprintf(buf,len,"%.17Lg", value); |