changeset 4620:b0acbb185a60

(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>.
author Paul Eggert <eggert@cs.ucla.edu>
date Wed, 03 Sep 2003 19:57:54 +0000
parents 5529b72adfa2
children 3d28ad4e18e2
files lib/ChangeLog lib/human.c
diffstat 2 files changed, 7 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/lib/ChangeLog
+++ b/lib/ChangeLog
@@ -1,5 +1,9 @@
 2003-09-03  Paul Eggert  <eggert@twinsun.com>
 
+	* human.c (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>.
+
 	* 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
--- a/lib/human.c
+++ b/lib/human.c
@@ -355,11 +355,9 @@
 	  }
       }
 
-    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++;