summaryrefslogtreecommitdiff
path: root/lib/human.c
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2003-09-03 19:57:54 +0000
committerPaul Eggert <eggert@cs.ucla.edu>2003-09-03 19:57:54 +0000
commit346048a288f00c94a93f05e0de073695dedb4325 (patch)
treecd7b94830a8a6e960a2118d67ad1a4df3018082c /lib/human.c
parent747b2f7cbc2aa116d0122af6e39d18bfcab1110b (diff)
downloadgnulib-346048a288f00c94a93f05e0de073695dedb4325.tar.gz
(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 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++;