Numerical representation

Numerical representation (computers)

Numerical data in a computer are written in basic units of storage made up of a fixed number of consecutive bits. The most commonly used units in the computer and communication industries are the byte (8 consecutive bits), the word (16 consecutive bits), and the double word (32 consecutive bits). A number is represented in each of these units by setting the bits according to the binary representation of the number. By convention the bits in a byte are numbered, from right to left, beginning with zero. Thus, the rightmost bit is bit number 0 and the leftmost bit is number 7. The rightmost bit is called the least significant bit, and the leftmost bit is called the most significant bit. Higher units are numbered also from right to left. In general, the rightmost bit is labeled 0 and the leftmost bit is labeled (n - 1), where n is the number of bits available. See Bit

Since each bit may have one of two values, 0 or 1, n bits can represent 2n different unsigned numbers. The range of these nonnegative integers varies from 0 to 2n - 1. To represent positive or negative numbers, one of the bits is chosen as the sign bit. By convention, the leftmost bit (or most significant bit) is considered the sign bit. A value of 0 in the sign bit indicates a positive number, whereas a value of 1 indicates a negative one. A similar convention is followed for higher storage units, including words and double words. Various conventions exist for representing integers and real numbers.