In computer science and information theory, a bit is the smallest possible meaningful piece of information. It is most often expressed as a digit of the binary numeral system: either 0 or 1. A string of 8 bits is called a byte.
If we take, for example, the binary number 11100111 (231 in decimal), and send it as a string of data of a network, we can send it in two ways: starting from left to right, or starting right to left. These two orderings are commonly called Most Significant Bit First, and Least Significant Bit First, respectively.
In this case, we referred to the first, or left-most bit as the Most Significant Bit (msb for short). The msb is the bit in a binary sequence that carries the greatest numerical value. For simpler reference, if we take a look at the equivalent decimal number, 231, the most significant digit is the leading 2. Compared to the other two digits, the leading 2 determines the greatest part of the number's numerical value, as it signifies the hundreds in the number. Analogous to this, the leading 1 in our binary number is it's most significant bit.
The msb can also be used to denote the sign bit of a binary number in it's one's or two's complement notation, with 1 meaning it's a negative number, and 0 meaning it's a positive number. One's compliment of a binary number is obtained by simply inverting all of it digits. However, in order to avoid the signed zero problem (where two possible zeros can exist: +0 and -0, which in turn leads to a number of different problems), two's complement is used. In order to calculate a binary number's two's complement, we first determine it's one's complement (by swapping it's digits like before), and then adding 1 to it. In basic calculus, this two's complement will behave like the negative number of the starting bit sequence, and it enables the use of adders (digital circuits used for addition) for subtraction. For example: we wish to subtract 1101 from 100111. First, we expand the number so it has the same amount of digits as the minuend. We get 001101. Then we invert it's digits to get 110010, and add 1 to it, getting 110011. We then proceed to add the two numbers. 100111 + 110011 = 1011010. Since we were working with 6-digit numbers, we remove the leading digit from the 7-digit result. This gives us the final result of 11010, or 26 in decimal. In the decimal system, our original task was to subtract 13 from 39, so we can easily verify the result to be accurate.
The least significant bit is the right-most bit in a string. It is called that because it has the least effect on the value of the binary number, in the same way as the unit digit in a decimal number has the least effect on the number's value. The lsb also determines whether the given number is odd or even. The number 11100111 is an odd number, since it's lsb (1) is an odd number. If we use the term least significant bits (plural), we are commonly referring to the several bits closest to, and including, the lsb. Another property of the least significant bits is that they often change drastically if the number changes. For example, if we add 1 to our example number, 11100111, we will get 11101000. The result of this minimal addition is that the four least significant bits have changed their value.
Some important uses for the lsb are hash functions and checksums. A hash function is a function that can be used to assign an index value to digital data, enabling faster lookups of items in a database or a large table. A checksum is a small piece of data that's used in the verification process for packets sent over a network. For example, every ASCII table character is encoded by a 7-bit binary number, but is stored as a whole byte. The last bit is used as a parity check bit. For example, the letter „A“ is encoded as 1000001. A parity check is preformed by adding together all the digits in the number. If we digit we get is even, an extra 0 is added at the end, and our letter „A“ is stored as 10000010. The letter „C“ (1000011) is stored as 10000111, due to the sum of digits being an odd number. This means that the sum of every byte will be an even number, and if, during a transmission, the data gets corrupted or altered, and the sum becomes an odd number, that byte of data is incorrect. There are advantages and disadvantages to every form of error detection. The advantage of the parity bit is that it is not a big block data and is relatively easy to implement, however, it can only be used to detect an odd number of errors, because an even number of altered bits will cancel each other out in respect to the parity bit.
The most and least significant bits have many uses in computing, some of which were explained here. In addition, two kinds of transmission protocols are also named after then, namely Most Significant Bit First, and Least Significant Bit First, indicating which „end“ of a bit stream will be transmitted first. It is also worth to note, that the abbreviations MSB and LSB (in capitals) stand for Most Significant Byte, and Least Significant Byte, for the same reason why MB stands for megabyte and Mb stands for megabit.
Email: [email protected]
We provide calculators related to the computer world.