Subject: Re: humanize_number again
To: Tomas Svensson <>
From: Alan Barrett <>
List: tech-userlevel
Date: 02/04/2002 11:02:58
On Mon, 04 Feb 2002, Tomas Svensson wrote:
> Here is a modified version of humanize_number(9) that I think should
> be sufficient for my df(1)/du(1) humanization needs. Differences
> from the kernel version are:
> [...]
> - three flags can be used : HN_DECIMAL tells it to use one decimal
>   for numbers less than 10, HN_NOSPACE removes the space between
>   the number and the prefix and HN_B will use the prefix "B" for
>   numbers that would normally not have a prefix (bytes less than
>   1000). Use 0 if no flags are used (not worth the trouble with
>   varargs?).

It's difficult to imagine using a divisor other than 1000 or 1024, so
the divisor arg could be replaced by more flags:  HN_DIVISOR_1000 and

I don't much like the name HN_DECIMAL, because it seems to imply a
choice of base (decimal versus hexadecimal or binary), whereas we want
it to imply a choice of precision (number of decimal places).  How about
HN_DECPLACES_1 (allowing for a possible future HN_DECPLACES_2)?

--apb (Alan Barrett)