[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: OT - Convert output of byte count to GB count?



On 2/12/2013 4:43 AM, Ralf Mardorf wrote:
On Mon, 2013-02-11 at 20:13 -0500, Jerry Stuckle wrote:
And this laptop has 4GB of ram
- which means 4,294,967,296 bytes - not 4,000,000,000 bytes.

My machine has got 4GB RAM too, but only 1,000,000,000 hex-bytes ;p.
Serious, there is no other correct sum than 4,294,967,296 bytes. For an
old former Assembler programmer it's disgusting to distinguish between
GB and GiB. OTOH kilos etc. are 10^x, but for the computer I do the math
based on 1024.

Regarding to hard disk drives GB/GiB values by one way or another are a
vague information about how much space there is on the disk, seemingly
the file system needs some space itself, for directory entries, bad
sectors and what ever else. However, for RAM the binary prefix is
absolutely correct and a "decimal prefix" less informative, while even
here we are aware that at least the kernel needs some space.


It is the amount of data the disk can hold. Sure, the OS needs some for directory entries, etc. How much the fs requires depends on the fs being used. But to the disk, that is also data. It doesn't mean there is that much room for files.

Theoretically, if you had a 200GB disk you could create a file system which would allow you to use the entire 200GB for file data, but I'm not sure how useful that would be.

People who never programmed should become aware that for programming
using bin and hex instead of dec often makes more sense, it's easier,
clearer.

  0  1  2  3   4   5  6    7
  1+ 2+ 4+ 8+ 16+ 32+ 64+128 = 255 = hex FF
                           but 256 possible values, including 0

Assumed you'll build a fence, 10m long and every 1m there should be 1
fence post, how many fence posts do you need?


11 :)

Regards,
Ralf



Reply to: