From: Jim Meyering Date: Wed, 3 Sep 2003 20:30:25 +0000 (+0000) Subject: (human_readable): Fix bug that rounded 10501 to 10k. X-Git-Tag: v5.0.91~65 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a42a4b7bd3b01df26d3ce260f741ccf87a8ce5f3;p=thirdparty%2Fcoreutils.git (human_readable): Fix bug that rounded 10501 to 10k. Bug reported by Lute Kamstra in . --- diff --git a/lib/human.c b/lib/human.c index a838e8c41e..285e4fd55e 100644 --- a/lib/human.c +++ b/lib/human.c @@ -355,11 +355,9 @@ human_readable (uintmax_t n, char *buf, int opts, } } - if (inexact_style == human_ceiling - ? 0 < tenths + rounding - : inexact_style == human_round_to_nearest - ? 5 < tenths + (2 < rounding + (amt & 1)) - : /* inexact_style == human_floor */ 0) + if (inexact_style == human_round_to_nearest + ? 5 < tenths + (0 < rounding + (amt & 1)) + : inexact_style == human_ceiling && 0 < tenths + rounding) { amt++;