summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/num2str.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/num2str.c b/lib/num2str.c
index 3597de2f..cd89a0e5 100644
--- a/lib/num2str.c
+++ b/lib/num2str.c
@@ -110,6 +110,9 @@ done:
sprintf(tmp, "%.*f", (int)(maxlen - strlen(tmp) - 1),
(double)modulo / (double)thousand);
+ if (tmp[0] == '1')
+ num++;
+
if (asprintf(&buf, "%llu.%s%s%s", (unsigned long long) num, &tmp[2],
unitprefix[post_index], unitstr[units]) < 0)
buf = NULL;