Subject: Re: CVS commit: src/lib/libc/gen
To: Perry E. Metzger <perry@piermont.com>
From: Simon Burge <simonb@wasabisystems.com>
List: source-changes
Date: 01/03/2004 13:12:58
[ oops, forgot to reply to this one when I first saw it ]
"Perry E. Metzger" wrote:
> Simon Burge <simonb@netbsd.org> writes:
> > Module Name: src
> > Committed By: simonb
> > Date: Fri Dec 26 11:30:36 UTC 2003
> >
> > Modified Files:
> > src/lib/libc/gen: humanize_number.c
> >
> > Log Message:
> > Don't ever add a ".0" to a single digit number.
>
> Why is .0 wrong when .1 would be okay? I can see not wanting to do 1.0
> bytes (where it would be silly), but if a decimal makes sense in some
> contexts, why not in others? Shouldn't we just be following normal
> scientific significant digits rules?
Maybe the wording of the commit message wasn't the best, but a "single
digit number" was an _input_ number of less than 10 - not any _output_
number less than 10. Other numbers will still be decimalised if
necessary. In the following, the size of the file is the same as the
filename:
-rw-r--r-- 1 simonb simonb 0B Jan 3 13:07 0
-rw-r--r-- 1 simonb simonb 1B Jan 3 13:07 1
-rw-r--r-- 1 simonb simonb 10B Jan 3 13:08 10
-rw-r--r-- 1 simonb simonb 100B Jan 3 13:08 100
-rw-r--r-- 1 simonb simonb 1.0K Jan 3 13:08 1000
-rw-r--r-- 1 simonb simonb 9.8K Jan 3 13:08 10000
Also, in a later message you say:
> Perhaps I'm not human, but I find randomly shifting numbers of
> significant digits confusing...
The old output of ls was:
-rw-r--r-- 1 simonb simonb 0.0B Jan 3 13:07 0
-rw-r--r-- 1 simonb simonb 1.0B Jan 3 13:07 1
-rw-r--r-- 1 simonb simonb 10B Jan 3 13:08 10
-rw-r--r-- 1 simonb simonb 100B Jan 3 13:08 100
-rw-r--r-- 1 simonb simonb 1.0K Jan 3 13:08 1000
-rw-r--r-- 1 simonb simonb 9.8K Jan 3 13:08 10000
I find the jump from "1.0B" to "10B" confusing... Maybe if
humanize_number() had a floating point version the output 0.0B
would mean more.
Simon.
--
Simon Burge <simonb@wasabisystems.com>
NetBSD Support and Service: http://www.wasabisystems.com/