On 20 Feb 2000, the humanize_number() function got a fifth argument--a

divisor.  This divisor replaces a hard-coded divisor of 1024.  To remain
consistent with the hard-coded SI prefix list, humanize_number should
probably only be called with a divisor of 1000 or 1024.
This is now documented.
This commit is contained in:
briggs 2000-08-05 14:58:03 +00:00
parent 8b89060c30
commit 0ad393d6e3
1 changed files with 9 additions and 2 deletions

View File

@ -1,4 +1,4 @@
.\" $NetBSD: humanize_number.9,v 1.1 1999/05/21 06:26:15 lukem Exp $
.\" $NetBSD: humanize_number.9,v 1.2 2000/08/05 14:58:03 briggs Exp $
.\"
.\" Copyright (c) 1999 The NetBSD Foundation, Inc.
.\" All rights reserved.
@ -45,6 +45,7 @@
.Ft int
.Fo humanize_number
.Fa "char *buf" "size_t len" "u_int64_t number" "const char *suffix"
.Fa "int divisor"
.Fc
.Ft int
.Fn format_bytes "char *buf" "size_t len" "u_int64_t number"
@ -71,10 +72,16 @@ would be too long to fit into
.Fa buffer ,
then divide
.Fa number
by 1024 until it will.
by
.Fa divisor
until it will.
In this case, prefix
.Fa suffix
with the appropriate SI designator.
Suitable values of
.Fa divisor
are 1024 or 1000 to remain consistent with the common meanings of the
SI designator prefixes.
.Pp
The prefixes are:
.Bl -column "Prefix" "Description" "Multiplier" -offset indent