What is represented by a sequence of bits?

Most everyone who uses a computer has heard the terms, kilobyte (kB), Megabyte (MB), Gigabyte (GB) and even Terabyte (TB), usually when referring to the size of computer files and hard drives as well as download speeds. Bandwidth or connection rates are measured in bits/second. But what is a bit and what is a byte and what do they have to do with computers?

Picture a basic room light. The light is either on or it is off. You control the current state of the light by flipping a switch that has only two settings, down (light off) and up (light on). The earliest computers used a series of mechanical switches to control the flow of electricity through their circuits, turning each one on or off. The on/off states of the circuits was used to represent and even store information. The smallest unit of information, representing the state of one switch, is known as a bit.

A bit is a binary digit and has only two possible values, zero or one. The value of the bit represents the current state of a single switch. If the switch is off, then the bit has the value zero. If the switch is on, then the bit has the value one.

A bit can only represent two different values, zero or one. To represent larger pieces of information, bits are strung together in sequences of 8 called bytes.

A byte is a sequence of binary digits made up of 8 bits.

A byte can represent any value from 00000000 through 11111111, for a total of 256 different possible values. Each digit in a byte can be thought of as representing an individual switch that is either off (zero) or on (one).

Modern computers rely on transistors, which pack millions of tiny switches into a chip smaller than your thumb, but information is still represented in essentially the same way: as a series of ones and zeros. By using binary, computers can represent information simply and efficiently using a system that is very effectively modeled in digital circuitry.

Review

  • A Bit is a binary digit with two possible values, zero or one
  • A Byte is a sequence of 8 bits and has 256 possible values from 00000000 through 11111111
  • A kilobyte (kB) is 1,024 bytes or 2^10 bytes
  • A Megabyte (MB) is 1,048, 576 bytes or 2^20 bytes
  • A Gigabyte (GB) is 1,073,741,824 bytes or 2^30 bytes
  • A Terabyte (TB) is 1,099,511,627,776 bytes or 2^40 bytes

Notes

  • The ones and zeros of bits and bytes can be used to represent letters, numbers, and even different keys on a computer keyboard.
  • A bit can be used to hold a Boolean (true/false) value. A value of zero represents ‘false’ and a value of one represents ‘true’.

Convention to identify bit positions

In computing, bit numbering is the convention used to identify the bit positions in a binary number.

Bit significance and indexing

What is represented by a sequence of bits?

The binary representation of decimal 149, with the LSB highlighted. The LSB represents a value of 1.

What is represented by a sequence of bits?

The unsigned binary representation of decimal 149, with the MSB highlighted. The MSB represents a value of 128.

In computing, the least significant bit (LSB) is the bit position in a binary integer representing the binary 1s place of the integer. Similarly, the most significant bit (MSB) represents the highest-order place of the binary integer. The LSB is sometimes referred to as the low-order bit or right-most bit, due to the convention in positional notation of writing less significant digits further to the right. The MSB is similarly referred to as the high-order bit or left-most bit. In both cases, the LSB and MSB correlate directly to the least significant digit and most significant digit of a decimal integer.

Bit indexing correlates to the positional notation of the value in base 2. For this reason, bit index is not affected by how the value is stored on the device, such as the value's byte order. Rather, it is a property of the numeric value in binary itself. This is often utilized in programming via bit shifting: A value of 1 << n corresponds to the nth bit of a binary integer (with a value of 2n).

Least significant bit in digital steganography

What is represented by a sequence of bits?

In digital steganography, sensitive messages may be concealed by manipulating and storing information in the least significant bits of an image or a sound file. The user may later recover this information by extracting the least significant bits of the manipulated pixels to recover the original message. This allows the storage or transfer of digital information to remain concealed.

Unsigned integer example

This table illustrates an example of decimal value of 149 and the location of LSB. In this particular example, the position of unit value (decimal 1 or 0) is located in bit position 0 (n = 0). MSB stands for most significant bit, while LSB stands for least significant bit.

Binary (Decimal: 149) 1 0 0 1 0 1 0 1
Bit weight for given bit position n ( 2n ) 27 26 25 24 23 22 21 20
Bit position label MSB LSB

Most- vs least-significant bit first

The expressions most significant bit first and least significant bit at last are indications on the ordering of the sequence of the bits in the bytes sent over a wire in a serial transmission protocol or in a stream (e.g. an audio stream).

Most significant bit first means that the most significant bit will arrive first: hence e.g. the hexadecimal number 0x12, 00010010 in binary representation, will arrive as the sequence 0 0 0 1 0 0 1 0 .

Least significant bit first means that the least significant bit will arrive first: hence e.g. the same hexadecimal number 0x12, again 00010010 in binary representation, will arrive as the (reversed) sequence 0 1 0 0 1 0 0 0.

LSB 0 bit numbering

What is represented by a sequence of bits?

LSB 0: A container for 8-bit binary number with the highlighted least significant bit assigned the bit number 0

When the bit numbering starts at zero for the least significant bit (LSB) the numbering scheme is called LSB 0.[1] This bit numbering method has the advantage that for any unsigned number the value of the number can be calculated by using exponentiation with the bit number and a base of 2.[2] The value of an unsigned binary integer is therefore

∑ i = 0 N − 1 b i ⋅ 2 i {\displaystyle \sum _{i=0}^{N-1}b_{i}\cdot 2^{i}}
What is represented by a sequence of bits?

where bi denotes the value of the bit with number i, and N denotes the number of bits in total.

MSB 0 bit numbering

What is represented by a sequence of bits?

MSB 0: A container for 8-bit binary number with the highlighted most significant bit assigned the bit number 0

When the bit numbering starts at zero for the most significant bit (MSB) the numbering scheme is called MSB 0.

The value of an unsigned binary integer is therefore

∑ i = 0 N − 1 b i ⋅ 2 N − 1 − i {\displaystyle \sum _{i=0}^{N-1}b_{i}\cdot 2^{N-1-i}}
What is represented by a sequence of bits?

Other

ALGOL 68's elem operator is effectively "MSB 1 bit numbering" as the bits are numbered from left to right, with the first bit (bits elem 1) being the "most significant bit", and the expression (bits elem bits width) giving the "least significant bit". Similarly, when bits are coerced (typecast) to an array of Boolean ([ ]bool bits), the first element of this array (bits[lwb bits]) is again the "most significant bit".

For MSB 1 numbering, the value of an unsigned binary integer is

∑ i = 1 N b i ⋅ 2 N − i {\displaystyle \sum _{i=1}^{N}b_{i}\cdot 2^{N-i}}
What is represented by a sequence of bits?

PL/I numbers BIT strings starting with 1 for the leftmost bit.

The Fortran BTEST function uses LSB 0 numbering.

See also

  • ARINC 429
  • Binary numeral system
  • Signed number representations
  • Two's complement
  • Endianness
  • Binary logarithm
  • Unit in the last place (ULP)
  • Find first set
  • MAC address: Bit-reversed notation

References

  1. ^ Langdon, Glen G. (1982). Computer Design. Computeach Press Inc. p. 52. ISBN 0-9607864-0-6.
  2. ^ "Bit Numbers". Retrieved 2021-03-30.

Retrieved from "https://en.wikipedia.org/w/index.php?title=Bit_numbering&oldid=1088576658"