[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug-gnulib] Rounding bug in human_readable from human.c
From: |
Lute Kamstra |
Subject: |
[Bug-gnulib] Rounding bug in human_readable from human.c |
Date: |
Mon, 01 Sep 2003 17:16:35 +0200 |
User-agent: |
Gnus/5.1003 (Gnus v5.10.3) Emacs/21.3.50 (gnu/linux) |
Dear people,
There seems to be a rounding bug in human_readable from human.c.
The following code:
char buf[LONGEST_HUMAN_READABLE + 1];
int n;
for (n = 10000; n <= 11000; n++)
printf ("%d is written as %s\n",
n,
human_readable (n, buf,
human_round_to_nearest |
human_autoscale |
human_SI,
1, 1));
produces this output:
10000 is written as 10k
[...]
10550 is written as 10k
10551 is written as 11k
[...]
11000 is written as 11k
I would expect the transition from 10k to 11k at 10500 as opposed to
10550.
Kinds regards,
Lute.
- [Bug-gnulib] Rounding bug in human_readable from human.c,
Lute Kamstra <=