Numeric data are represented in the computer using straight binary coding, which encodes and 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.

**Integer Representation **

Integers or fixed-point numbers have no decimal points. An integer I is represented in the memory of the computer by its binary form if I is positive, and by its 2’s complement if I is 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 stores-423 in a memory location in 2’s complement form for 423, that is

In the first display the dots represent omitted 0s; in the second omitted 1’s.

The computer can tell whether an integer 1 in memory is positive or negative by looking at the left most bit. If the left most bit is 0, then 1 is positive; if the left most bit is 1, then 1 is negative. Accordingly, the largest (positive) integer that can be stored in a 32-bit memory location isOr 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:**