Re: Formatting a long decimal into Gb, Mb, or Kb (using String.format)
Arvin Portlock wrote On 11/08/07 12:48,:
I was wondering whether anybody would call me on this! Switching to
capital 'B' was an easy decision. For the letter prefixes though I
decided to go with common usage and consistency (GB, MB, kB???)
incorrect as it may be. Gi, Mi, etc., is simply too pedantic for
my audience, who are other programmers here at work who under-
stand the difference between powers of 10 and powers of 2 so I'm
unlikely to invite lawsuits for misleading information! Users first!
The "mutable mega" actually caused me some grief once
at a PPOE. Our product's installation said it needed at
least 40 megabytes of available disk space (I don't recall
the actual number, but let's just pretend it was 40), and
a test engineer set out to verify that the installation would
in fact succeed with that bare minimum. So he filled his
disk with garbage file until Windows said 40,000,000 bytes
remained unused, fired up our installation, watched it die,
and filed a bug report.
Of course, what happened was that our script checked
for at least 41943040 = 40*1024*1024 bytes and refused to
run if there wasn't enough ...
Probably the worst abuse of this confusion referred to
the so-called "1.44 megabyte floppy." The actual capacity
of this device was 2880 512-byte blocks, or
You will note that "1.44" appears *nowhere* in this list
of expressions of the capacity! To get to 1.44, you must
express the capacity in a miscegenated decimal-and-binary
unit of 1024000 bytes, a unit I suggested should be called
the "maybebyte" in honor of the floppy's reliability ...