summaryrefslogtreecommitdiff
path: root/lib/human.c
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2003-09-03 20:30:25 +0000
committerJim Meyering <jim@meyering.net>2003-09-03 20:30:25 +0000
commita42a4b7bd3b01df26d3ce260f741ccf87a8ce5f3 (patch)
tree477e80038ab9b9e09a7bc015c4ca8baa524f982a /lib/human.c
parentc8b7d2500d68bf53c2ae80e9c146d5c7c19acaec (diff)
downloadcoreutils-a42a4b7bd3b01df26d3ce260f741ccf87a8ce5f3.tar.xz
(human_readable): Fix bug that rounded 10501 to 10k.
Bug reported by Lute Kamstra in <http://mail.gnu.org/archive/html/bug-gnulib/2003-09/msg00003.html>.
Diffstat (limited to 'lib/human.c')
-rw-r--r--lib/human.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/lib/human.c b/lib/human.c
index a838e8c41..285e4fd55 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++;