On Sep 24, 2007, at 11:53 AM, Greg Freemyer wrote:

On 9/24/07, Adil Mujeeb <[EMAIL PROTECTED]> wrote:
<snip>
[EMAIL PROTECTED]:~> ls -lh test
-rw-r--r-- 1 adil group 2.0G 2007-09-24 23:51 test
[EMAIL PROTECTED]:~> du -h test
2.1G    test   <--------------------- why it is showing 2.1 GB

I could not understand this difference. Could anybody explain this behavioour?

<snip>
ie. "ls" is reporting Gibibytes and "du" is reporting Gigabytes.

That does seem to be the case:

2147483648 / 1024^3 = 2.000
2147483648 / 1000^3 = 2.14748... Which rounds to 2.1.

It's unfortunate that ls in this case doesn't use the new unit's abbreviation. It does its math so as to return Gibibytes but then fails to use the "GiB" unit so the user knows it did that.

This whole issue really gets interesting when you start looking at prices for data-center-class storage. You have big numbers for both money and bytes. No one would think to say $1M is really $1,048,576 but programmers and users disagree on whether 1MB is 1,048,576 or 1,000,000 bytes.

Fun!

-Mike


--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to [EMAIL PROTECTED]
Please read the FAQ at http://kernelnewbies.org/FAQ

Reply via email to