Numeric data are represented in the computer using straight binary coding, which encodes an entire number as a whole. Straight binary coding requires that numbers be stored in computer memories as a fixed number of bits. A group of bits so treated as a unit is called a word, and the number of bits is called the length of the word. Let’s know the process of numeric data representation on the computer.
Integers or fixed-point numbers have no decimal points. An integer 1 is represented in the memory of the computer by its binary form if 1 is positive, and by its 2’s complement if I am negative.
Example: Storing 1101001112 that is 42310, and – 42310 in 32-bit memory location
For simplicity, we assume that the word length is 32. The computer stores 423 that is 1101001112 in a 32-bit memory location by introducing 0s at the beginning of the binary form. Thus:
The computer can tell whether an integer 1 in memory is positive or negative by looking at the left-most bit. If the leftmost bit is 0, then 1 is positive; if the leftmost bit is 1, then 1 is negative. Accordingly, the largest (positive) integer that can be stored in a 32-bit memory location is
Or 2³¹ -1, which is approximately 2 billion. Similarly, the smallest (that is negative) integer that can be stored in a 32-bit memory location is -2³¹ -1, or approximately -2 billion.
You may like also: