Merge branch 'num2str-patch' of https://github.com/gloit042/fio
[fio.git] / lib / num2str.c
index 3597de2f10903b461d890a536b55033ede87237f..cd89a0e59171291017ece4429bc70b4e43eb95ca 100644 (file)
@@ -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;