I got a comment about the conversion of bps to kbps used in the LTE throughout calculator that reminded me about this bizarre situation that we usually do not convert telecom bits into kilobits the same way we convert storage bytes into kilobytes. Here is the reason why.
bits and bytes
There is a very weird situation in the units utilized for digital storage and data transfer rates where things don’t add up.
In the early days of computer science, it was defined and accepted that 1 kilobit = 1,024 bits and 1 megabit = 1,024 x 1,024 bits, and so on. Working with powers of 2 was logic for everyone and it worked well.
When the era of personal computer arrived, a lot of variants of the meaning of kilo came up and it became a mess:
- Computer RAM: 1 megabyte = 2^20 = 1,048,576 bytes
- Computer Storage: 1 megabyte = 1,000,000 bytes
- LAN designers: 1 megabit per second = 1,048,576 bit/s
- Telecommunications engineers: 1 megabit per second = 10^6 bit/s.
- 3.5″ floppy disk (1.44 MB): 1 megabyte = 1,024,000 bytes (really?? WTF!)
The risk of incompatibility between systems and telecommunications standards is real.
At some point, the National Institute of Standards and Technology (NIST) decided to clarify the situation and stated that 1 kilobit would equal 1,000 bits, following the usual practice on the International System (SI) for kilo (10^3), mega (10^6), giga (10^9).
This standard was easy for most of the people but was certainly not adapted for computer science.
So to cover all needs, a new convention was invented by the International Electrotechnical Commission (IEC) around 1998, thee IEC_80000, which defined the following:
Prefix Bytes Prefix Bytes 1 Byte = (2^10)^0 = 1 1 Byte = (10^3)^0 = 1 1 Kibibyte = (2^10)^1 = 1024 1 Kilobyte = (10^3)^1 = 1000 1 Mebibyte = (2^10)^2 = 1048576 1 Megabyte = (10^3)^2 = 1000000 1 Gibibyte = (2^10)^3 = 1073741824 1 Gigabyte = (10^3)^3 = 1000000000 1 Tebibyte = (2^10)^4 = 1099511627776 1 Terabyte = (10^3)^4 = 1000000000000
In this convention, “MiB” stands for “megabinary byte”, which can be abbreviated to “mebibyte”, so essentially the ‘i’ is added for “binary”. This binary system defines the prefixes as follows: kibi (2^10^1), mebi (2^10^2), gibi (2^10^3), and so on.
So we now have the following differences:
- 1 Kilobit (Kb) = 1,000 bits, 1 Megabit (Mb) = 1,000 Kilobits, and so on.
- 1 Kibibit (Kib) = 1,024 bits, 1 Mebibit (Mib) = 1,024 Kibibits, and so on.
- 1 Kilobyte (KB) = 1,000 bytes, 1 Megabyte (MB) = 1,000 Kilobytes, and so on.
- 1 Kibibyte (KiB) = 1,024 bytes, 1 Mebibyte (MiB) = 1,024 Kibibytes, and so on.
If you pay attention at your Linux console, you’ll see that this convention is used.
But even today, it has never really been adopted by everyone and the confusion still exists today in many systems, as the difference between the decimal unit and binary unit becomes significant in the higher orders:
I would not be surprised that one day we find out that a major incident or accident happened because of a wrong conversion between binary and decimal prefixes, the same way this spatial orbiter probe was lost during positioning maneuver due to a units mismatch between two pieces of codes, one giving US units output while the other one was expecting SI metric units.