开发者

Representation of a Kilo/Mega/Tera Byte

开发者 https://www.devze.com 2023-03-16 11:13 出处:网络
I was getting a little confused with the representation of different units of bytes. It is accepted throughout that 1 byte = 8 bits.

I was getting a little confused with the representation of different units of bytes.

It is accepted throughout that 1 byte = 8 bits.

However, in a lot of sources I have seen that

1 kiloByte = 2^10 bytes = 1024 bytes

AND

1 kiloByte = 1000 bytes

Doesn't this contradict as in both cases it is stated that 1 byte is 8 bits...?

Different sources claim different reasons for these different representations, thus I am not sure what the most important/real reason is for开发者_开发技巧 this rather confusing difference in representation.

Can someone please explain and clarify?


It is accepted throughout that 1 byte = 8 bits

However, in a lot of sources I have seen that

1 kiloByte = 2^ 10 bytes = 1024 bytes

AND

1 kiloByte = 1000 bytes

To make sure we're all clear, your question is "Is a kilobyte equal to 1024 bytes or 1000 bytes?".

Doesn't this contradict as in both cases it is stated that 1 byte is 8 bits...?

This is irrelevant to the question.

So, let's begin. In SI (metric), the multiplier of 1000 is called kilo, abbreviated k. k always means 1000, never anything else.

When binary computers entered the world, we noticed that 2 to the power of 10 is 1024, which is conveniently close to 1000. Computer engineers decided to abuse this coincidence and say that kilo means 1024. By extension, they say that mega means 10242 (instead of the proper definition of 10002), and so on with giga, tera, etc.

While the difference between 1000 and 1024 is small for many purposes, there are times when exact answers are required, and this is where the abusive terminology hurts everyone. Only after decades after kilo=1024 got established did anyone really try to fix the problem. The IEC proposed new prefixes for the binary multipliers: 1024 = kibi, 10242 = mebi, 10243 = gibi, etc.

In summary, the notion that kilo=1024 is an abusive deviation from the consistent SI definition of kilo=1000. While kilo=1024 is popular in the computer industry, it is nevertheless wrong and should be replaced by kibi=1024. Or numbers need to be recomputed to reflect the true definition of kilo/mega/etc. (For example, "512 MB" of RAM is actually about 536.9 MB.)

Btw, don't use random capitalization; it's spelled kilobyte, not kiloByte.

References and links:

  • http://physics.nist.gov/cuu/Units/binary.html
  • http://en.wikipedia.org/wiki/Kilo-
  • http://en.wikipedia.org/wiki/Kilobyte
  • http://en.wikipedia.org/wiki/Kibibyte
  • http://xkcd.com/394/


When you talk about data information in computer science, you always have to calculate the result by a power of two. See what wikipedia says:

"In computing, a binary prefix is a specifier or mnemonic that is prepended to the units of digital information, the bit and the byte, to indicate multiplication by a power of 2. In practice the powers used are multiples of 10, so the prefixes denote powers of 1024 = 2^10."

Sometimes people use to round it as you have mentioned, but it is a bad use of it.


I don't see what the byte to bits has to do with anything if you are asking whether 1 kiloByte is equal to 1024 or 1000 bytes. These measurements are not set in stone and are not really controlled at all. Computer makers can (and have) used the 1000 conversion to make it look like they have more memory.

The problem comes up when thinking about binary (base 2) or base 10. Base 10 you would use 1000, base 2, 1024.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号