Recall that the ALU performs all the arithmetic and logic operations. To achieve this task it is must be capable of representing the operands as binary digits.

Signed representation of Integers

The popular scheme used to represent integers is called sign and magnitude representation. In this scheme, the most significant bit is reserved to represent the sign of the integer and the remaining bits used to represent its magnitude. Accordingly, the MSB is referred to as the sign bit.

 

E.g. 011011011 = + 11011011

With eight bits we may represent

+127 = 01111111

- 127 = 11111111

One’s complement is found by inverting all bits with the exception of the sign bit. For two’s complement, we perform the same operation and in addition, ‘1’ is added to the least significant bit position.

 

Floating Point Representation of Real Numbers

A Real number, when represented within the computer, has three parts.

 

  1. Sign bit

  2. Exponent (Abscissa)

  3. Mantissa (Significand or Fraction)

 

To represent a real number using single precision 4 bytes are used, i.e. 4*8=32 bits.

The structure of a Real number is as illustrated in Figure 6-2.

fig6-2.gif (16157 bytes)

 Figure 6-2 Arrangement of typical single precision Real number

 However for the IEEE16 standard, the mantissa is composed of 24 bits as indicated in the below table.

 

Part

Number of bits

Mantissa

24

Exponent

8

Sign

1

 

Simple arithmetic indicates that it would take 33 bits to store a 4-byte single precision number but we are only using 32.

How is this so

 

Although the mantissa is quoted as 24 bits only 23 bits are used. Normalisation allows us to discard the single ‘1’ bit to the left of the radix point (i.e. binary point for base 2). To illustrate, let us convert the decimal number 12 to binary and then normalise.

(12)10 = (1100)2

Normalising (1100)2 becomes (1.1x23)2

Notice that as a result of the normalisation all numbers will be written as 1.?????x2? and as a result the integer part does not have to be stored. The bits after the radix point are the only digits that are stored.

 

Another alteration is made to the Real number representation. In this instance, the exponent is stored as a Biased Exponent. A bias of +127 is added to the exponent.

 

Let us now look at a few examples of how Real numbers are represented.

  1. +12 (decimal)

Normalising the mantissa we get +1.1x23

Sign = 0 (+ve)

Exponent = 3+127 = 130

Mantissa = .1

Therefore the representation of +12 is:

positve12-representation.gif (28662 bytes)

  1. Similarly, for –12 we get:

 

negative12-representation.gif (26077 bytes)

 

To represent a real number using single precision 8 bytes are used, i.e. 8*8=64 bits.

The structure of a Real number is as illustrated in Figure 6-3.

fig6-3.gif (9856 bytes)

  Figure 6-3 Arrangement of typical double precision Real number

 With double precision the bias for the exponent is 1023.

 

There are 2 exceptions to the rules for floating point numbers (whether single or double precision)

  1. The number 0.0is stored as all zeros

  2. The number infinity is stored as all ones in the exponent and all zeros in the mantissa.

 

The sign bit indicates (+ /-) 0.0 or (+/-) infinity.