[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Bug-gnulib] Rounding bug in human_readable from human.c
From: |
Paul Eggert |
Subject: |
Re: [Bug-gnulib] Rounding bug in human_readable from human.c |
Date: |
03 Sep 2003 13:00:43 -0700 |
User-agent: |
Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 |
Lute Kamstra <address@hidden> writes:
> 10550 is written as 10k
Thanks for the bug report. I installed the following patch into gnulib.
2003-09-03 Paul Eggert <address@hidden>
* 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>.
--- human.c.~1.21.~ Fri Jun 6 15:37:23 2003
+++ human.c Wed Sep 3 12:49:04 2003
@@ -355,11 +355,9 @@ human_readable (uintmax_t n, char *buf,
}
}
- 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++;