From 346048a288f00c94a93f05e0de073695dedb4325 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Wed, 3 Sep 2003 19:57:54 +0000 Subject: [PATCH] (human_readable): Fix bug that rounded 10501 to 10k. Bug reported by Lute Kamstra in . --- lib/ChangeLog | 4 ++++ lib/human.c | 8 +++----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/ChangeLog b/lib/ChangeLog index 3d9f379e0f..795d1ab3ed 100644 --- a/lib/ChangeLog +++ b/lib/ChangeLog @@ -1,5 +1,9 @@ 2003-09-03 Paul Eggert + * human.c (human_readable): Fix bug that rounded 10501 to 10k. + Bug reported by Lute Kamstra in + . + * getdate.y (relative_time_table): Use tDAY_UNIT for "tomorrow", "yesterday", "today", and "now" rather than tMINUTE_UNIT. Of course with correspondingly smaller numbers for tomorrow and 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++; -- 2.30.2