aMule Forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

We're back! (IN POG FORM)

Pages: [1] 2

Author Topic: Incorrect "kB" unit displayed for file sizes  (Read 11392 times)

pochu

  • Approved Newbie
  • *
  • Karma: 4
  • Offline Offline
  • Posts: 34
Incorrect "kB" unit displayed for file sizes
« on: May 20, 2007, 10:59:05 PM »

From https://bugs.launchpad.net/ubuntu/+source/amule/+bug/115861

---

Amule displays file sizes and data rates using units like "1 kB = 1,024 bytes" and "1 MB = 1,048,576 bytes", etc. For instance, a 744762 byte file is displayed as "727 kB".

When written with a lowercase k, though, "kB" means 1,000 bytes, as per SI. If you're going to use the traditional "KB" = 1,024 bytes notation, it should be uppercase.

(Technically, this is also incorrect, and the international SI/IEC standard is:
"kB" = 1,000 bytes, as used in apt-get, fdisk, etc.
"KiB" = 1,024 bytes, as used in BitTornado, GParted, ifconfig, etc.

Linux man page: http://www.annodex.net/cgi-bin/man/man2html?units+7
GNU coreutils manual: http://www.gnu.org/software/coreutils/manual/html_chapter/coreutils_2.html#SEC4

But this usage is not yet universally accepted.)

Even if you don't accept the standard, though, using lowercase k to mean 1,024 is incorrect; it should be uppercase "KB".


---

I know it's a really minor, but what do you guys think about it?
Logged

Kry

  • Ex-developer
  • Retired admin
  • Hero Member
  • *****
  • Karma: -665
  • Offline Offline
  • Posts: 5795
Re: Incorrect "kB" unit displayed for file sizes
« Reply #1 on: May 20, 2007, 11:08:12 PM »

Long story. Last time we checked, we hated "kiB" and "MiB" with a passion.
Logged

lfroen

  • Guest
Re: Incorrect "kB" unit displayed for file sizes
« Reply #2 on: May 21, 2007, 07:46:05 AM »

Quote
When written with a lowercase k, though, "kB" means 1,000 bytes,
No standard say that

Quote
But this usage is not yet universally accepted.)
That's understatement.

amule uses K = 2^10 convention because we're talking about file sizes, and in computers, "K" (or "k", doesn't matter) means 2^10.
Logged

skolnick

  • Global Moderator
  • Hero Member
  • *****
  • Karma: 24
  • Offline Offline
  • Posts: 1188
  • CentOS 6 User
Re: Incorrect "kB" unit displayed for file sizes
« Reply #3 on: June 05, 2007, 05:30:51 AM »

Quote
When written with a lowercase k, though, "kB" means 1,000 bytes,
No standard say that
Wrong, the International Bureau of Weights and Measures says it should be a lowercase k: http://www.bipm.fr/en/si/prefixes.html
Quote
But this usage is not yet universally accepted.)
That's understatement.

amule uses K = 2^10 convention because we're talking about file sizes, and in computers, "K" (or "k", doesn't matter) means 2^10.
I agree with pochu, the right thing would be naming the units as KiB=2^10 Bytes, MiB=2^20 Bytes, etc. However, I also agree that it would confuse some people seeing it like that. Also, it's not true that "in computers, "K" (or "k", doesn't matter) means 2^10". k has always meant 10^3, a different thing is that when these units arose there was no better way to name them, so they were kinda "rounded" to their nearest greek prefix, but that is technically incorrect. The correct would be these: http://physics.nist.gov/cuu/Units/binary.html (notice that all the units use capital K, M etcetera, and lowercase i).

Regards.
« Last Edit: June 05, 2007, 05:33:54 AM by skolnick »
Logged

wuischke

  • Developer
  • Hero Member
  • *****
  • Karma: 183
  • Offline Offline
  • Posts: 4292
Re: Incorrect "kB" unit displayed for file sizes
« Reply #4 on: June 05, 2007, 10:21:29 AM »

I don't like KiB either, but switching to upper-case 'K' sounds reasonable.
I'll have a look at it as soon as I get hold of a *nix computer and am not busy with other things.
Logged

lfroen

  • Guest
Re: Incorrect "kB" unit displayed for file sizes
« Reply #5 on: June 05, 2007, 11:00:38 AM »

Quote
rong, the International Bureau of Weights and Measures says it should be a lowercase k: http://www.bipm.fr/en/si/prefixes.html

Yea, it also says, that 2^10 should be called "kibi":
http://physics.nist.gov/cuu/Units/binary.html (link on the bottom of page).


Quote
Also, it's not true that "in computers, "K" (or "k", doesn't matter) means 2^10"
Quote
k has always meant 10^3
Quote
different thing is that when these units arose there was no better way to name them, so they were kinda "rounded" to their nearest greek prefix

You are confused. There's no "rounding" involved here. Different standards have different ideas about k/K/Ki/ki etcetera. It's not that "k is not correct, but K/ki/Ki is". The definition of "correctness" varies whether you respect IEEE more that IEC or visa versa.

For full explanation consider reading
Quote
http://en.wikipedia.org/wiki/Binary_prefix

Now, aMule is not network test application. In the networking, K (or k) means 10^3. Nobody measures transfer speed in units of power of 2. Moreover, in most cases "bps" which is "bit per second" (not byte, bit!) is measured, since networks doesn't transfer bytes, but bits. "Gigabit network", for example, means 10^9 bit per second. Some use a notation of "b" for bit and "B" for byte, but this is not a common requirement.
Back to aMule, which is file-sharing application, where "file" is keyword. And file sizes are measured in units of power of 2, which you can write as k or K. Nobody will understand "file with size 2k is 2000 bytes" no matter what is your idea about meaning of "k". File sizes are power of 2. Always.
So, in order to make speed of transfer, file size and transfer time to correlate, aMule displays speed in bytes per second and power of 2.
Conclusion: write prefix any way you want - it won't be become "correct" and won't change meaning.
« Last Edit: June 06, 2007, 08:25:10 AM by lfroen »
Logged

Kry

  • Ex-developer
  • Retired admin
  • Hero Member
  • *****
  • Karma: -665
  • Offline Offline
  • Posts: 5795
Re: Incorrect "kB" unit displayed for file sizes
« Reply #6 on: June 05, 2007, 10:56:11 PM »

I.e don't change anything.
Logged

skolnick

  • Global Moderator
  • Hero Member
  • *****
  • Karma: 24
  • Offline Offline
  • Posts: 1188
  • CentOS 6 User
Re: Incorrect "kB" unit displayed for file sizes
« Reply #7 on: June 06, 2007, 03:51:23 AM »

You are confused. There's no "rounding" involved here.
No, I am not confused. I know there is no rounding. I simply failed to explain clearly what I meant, that's all. It's more of a problem of thinking in my mother tongue, then translating it literally into english. The result is not always what I would like to.

Regards.
Logged

Arichy

  • Full Member
  • ***
  • Karma: 0
  • Offline Offline
  • Posts: 224
Re: Incorrect "kB" unit displayed for file sizes
« Reply #8 on: June 09, 2007, 04:55:10 PM »

Just use binary prefixes "KiB" and "MiB" and the problem is solved for all time.

K means Kilo and that's 1.000, not 1024.

Also DVD capacity is in real Kilo ("4,7 GB" = 4,7 x 1000 x 1000 x 1000 Byte)

See

http://en.wikipedia.org/wiki/Binary_prefix

http://physics.nist.gov/cuu/Units/binary.html
Logged
Gentoo i686

Kry

  • Ex-developer
  • Retired admin
  • Hero Member
  • *****
  • Karma: -665
  • Offline Offline
  • Posts: 5795
Re: Incorrect "kB" unit displayed for file sizes
« Reply #9 on: June 09, 2007, 09:17:54 PM »

Er... have you read the thread?
Logged

Omegatron

  • Newbie
  • Karma: 0
  • Offline Offline
  • Posts: 1
Re: Incorrect "kB" unit displayed for file sizes
« Reply #10 on: August 11, 2007, 06:01:30 PM »

(I posted the original bug on Launchpad.  It's not a huge big deal, but I'm going through old unfinished bug reports...)

amule uses K = 2^10 convention because we're talking about file sizes, and in computers, "K" (or "k", doesn't matter) means 2^10.

No.  Lowercase k means 1000 and uppercase K means 1024.  For M, G, etc. the meaning is ambiguous.

The definition of "correctness" varies whether you respect IEEE more that IEC or visa versa.

Both the IEEE and IEC recommend the KiB standard.  IEC 60027-2 says the same thing as IEEE 1541: k = 1000, Ki = 1024

For an explanation, type "man 7 units" in a terminal.

Quote
In the networking, K (or k) means 10^3.

In networking, lowercase k means 10^3.  K does not.

Quote
Nobody measures transfer speed in units of power of 2.

In telecommunications they don't, but I think some software does for file transfers.  I'm not sure which is more appropriate for aMule, but please use consistent symbols.

Quote
Moreover, in most cases "bps" which is "bit per second" (not byte, bit!) is measured, since networks doesn't transfer bytes, but bits.

Yeah, but in software, file transfers are usually measured in bytes, for obvious reasons.

Bittornado, for instance, shows file transfers in kB/s (1000 bytes per second), and file sizes in KiB (1024 bytes), with standardized symbols.

Quote
Some use a notation of "b" for bit and "B" for byte, but this is not a common requirement.

The IEC standard says "B" for byte and "bit" for bit.

Quote
And file sizes are measured in units of power of 2, which you can write as k or K.

No.  You either write them with the old convention of uppercase KB, MB, GB, or with the standardized convention used elsewhere in the linux world of KiB, MiB, GiB.  I would prefer the latter, because it is unambiguous, but lowercase kB for 1024 bytes is just plain wrong, under any convention.  Things like nautilus-cd-burner use the MiB convention because you can see quickly, for instance, what size CD you'll need to fit the ISO you downloaded from aMule.

Quote
Nobody will understand "file with size 2k is 2000 bytes" no matter what is your idea about meaning of "k".

Of course.  I hope no one is misinterpreting this as a request to use 1000 for file sizes.  (Although apt does it this way: kB = 1000 bytes for file sizes.  Weird, though.)

Quote
So, in order to make speed of transfer, file size and transfer time to correlate, aMule displays speed in bytes per second and power of 2.

Good.  I'm just asking you to use consistent symbols.  Follow one convention or the other. Preferably the standardized one, but whatever.

Quote
Conclusion: write prefix any way you want - it won't be become "correct" and won't change meaning.

The reason that people want things to be "correct" is so that apps are consistent with each other and meanings are clear.  It often doesn't matter (though why are you showing file sizes with such detail if they don't matter?), but in the few circumstances that it does matter, the user shouldn't have to waste time digging around to figure out the exact meanings of things.
Logged

phoenix

  • Evil respawning bird from aMule Dev Team
  • Developer
  • Hero Member
  • *****
  • Karma: 44
  • Offline Offline
  • Posts: 2503
  • The last shadow you'll ever see
Re: Incorrect "kB" unit displayed for file sizes
« Reply #11 on: August 11, 2007, 07:30:40 PM »

I think we should change "k" to "kiB" in the cases that we mean 1024, and so on for M and G.

"k", "M" and "G" were born to be powers of ten, not powers of 2. I have no problems with "kiB", "MiB" and "GiB" if they are in an accepted standard.

"K" is for people that still did not realize that the SI unit for a thousand is spelled with a lower case "k". Which is odd, since the prefix for all the other positive powers of ten are capital letters.

Ever since my "day one" with computers I have cursed the guy who invented that ambiguity.

Cheers!
Logged

Kry

  • Ex-developer
  • Retired admin
  • Hero Member
  • *****
  • Karma: -665
  • Offline Offline
  • Posts: 5795
Re: Incorrect "kB" unit displayed for file sizes
« Reply #12 on: August 11, 2007, 08:21:04 PM »

Quote from: Wikipedia
The one-letter symbols are identical to SI prefixes, except for "K", which is used interchangeably with "k"

Also, phoenix, if I even see "MiB" in aMule, I'm going to fucking kill you all. Painfully. Probably with fire.
Logged

phoenix

  • Evil respawning bird from aMule Dev Team
  • Developer
  • Hero Member
  • *****
  • Karma: 44
  • Offline Offline
  • Posts: 2503
  • The last shadow you'll ever see
Re: Incorrect "kB" unit displayed for file sizes
« Reply #13 on: August 11, 2007, 08:26:18 PM »

Quote from: Wikipedia
The one-letter symbols are identical to SI prefixes, except for "K", which is used interchangeably with "k"

Also, phoenix, if I even see "MiB" in aMule, I'm going to fucking kill you all. Painfully. Probably with fire.
Not a real problem for someone whose nick is Phoenix :P
Logged

Kry

  • Ex-developer
  • Retired admin
  • Hero Member
  • *****
  • Karma: -665
  • Offline Offline
  • Posts: 5795
Re: Incorrect "kB" unit displayed for file sizes
« Reply #14 on: August 11, 2007, 08:27:12 PM »

Good point. Also, you're not answering on IRC :(

Quote from: Wikipedia
Some have suggested that "k" be used for 1,000, and "K" for 1,024, but this cannot be extended to the higher order prefixes and has never been widely recognised.
Logged
Pages: [1] 2