# Computer Arithmetic Study Notes for GATE CS Exam

By Priya Upadhyay|Updated : September 16th, 2021

Computer Arithmetic Study Notes for GATE CS Exam: (ALU)Arithmetic and Logical Unit is responsible for doing all arithmetic operations in a computer with the help of control units and registers of the CPU. The following diagram is a block diagram of the computer where ALU is shown as a CPU component and other components.

Computer Arithmetic Study Notes for GATE CS Exam: (ALU)Arithmetic and Logical Unit is responsible for doing all arithmetic operations in a computer with the help of control units and registers of the CPU. The following diagram is a block diagram of the computer where ALU is shown as a CPU component and other components.

## Fixed Point Representation

Because of the limitation of computer hardware, everything, including the sign of the number, must be represented either by 0's or 1's. So, for a positive number, the sign bit or leftmost bit is always 0, and the sign bit should be 1 for a negative number.

## Floating Point Representation

A floating-point number can be represented using two points. The beginning part is called mantissa (m), and another part is the exponent (e). So, in a number system with base r, a floating-point number with mantissa m and exponent e will be represented (m × re).

The value of m possibly is a fraction of an integer. So, the number (2.25)10 can be also be written as 0.225 × 101.

Here, e = 1, r = 10 and m = 225 .

MSB will be signed for the n bit register, and (n – 1) bits will be magnitude.

So, the positive largest number can be stored (2n-1 – 1), and the negative lowest number is –(2n-1 – 1).

## Actual Number Finding Technique

Here, we always store exponent is positive. A biased number is also called an excess number. Since the exponent is stored in biased form, the bias number is added to the actual exponent of the given number. Given formula can calculate the actual number from the contents of the registers.

Actual number = (–1)s (1 + m) × 2e–Bias

m = Mantissa value of register
S = Sign bit
e = Exponent value of register
Bias number of n bits is used to represent exponent, then
Bias number will be equals(2
n–1 –1)

The range of exponent is –(2k–1 –1) to 2k–1.

## IEEE Floating Point Representation

IEEE floating-point representation provides a 32-bit format and a 64-bit format for single-precision values and double-precision values respectively.
The double-precision format consists of a mantissa field that is as long (more than twice) as the mantissa field of the single-precision format, this permits greater accuracy.

The mantissa field expects an implicit leading bit 1, and the
Exponent field takes the excess system with a bias value of 127 and 1023 for the single-precision and the double-precision format respectively.
Representations are reserved for some special values such as zero, infinity, denormalized values, NAN (not-a-number).

## Ranges of Normalized numbers using single precision

The representation format of a normalized number is:

(–1)S. M . 2E, where 1.0 ≤ M < 2.0 and –126 ≤ E ≤ 127.

The smallest positive number is: 1.0 × 2–126 which is equivalent to 1.2 × 10–38

The largest positive number is: (2 – 2–23) × 2127, minutely less than 2 × 2127 = 2128 which is equivalent to 3.4 × 1038.

The range for positive normalized numbers in this format is 1.2 × 10–38 to 3.4 × 1038.

## Normalization using Single Precision Floating Point Representation

Step 1: Find the sign bit. Save this bit for later use.

Step 2: Change the absolute value of the number into a normalized form.

Step 3: Find the eighth-bit exponent field.

Step 4: Identify the 23–bit significance.

Step 5: Arrange all the fields in a particular order.

Step 6: Now, rearrange the bits, make a group of four from the left side.

Step 7: Write the number in eight hexadecimal digits.

### Example: The Negative Number – 0.750

Step 1: If the number is negative, then set the sign bit, S = 1.

Step 2: The exponent is P = – 1. 0.750 = 1.5 ∙ 0.50 = 1.5 ∙ 2–1

Step 3: As an eight–bit number, this is 0111 1110. P + 127 = – 1 + 127 = 126.

Step 4: Change 1.5 into binary, it will be1.12. Then, the sign bit is 10000.

To get the significant bit, drop the leading "1" from the entire number.

Note: We do not extend the significand bit to its full 23 bits but only place a few zeroes after the last 1 in the string.

Step 5: Arrange the bits: Sign | Exponent | Significand

Sign Exponent Significand

1 0111 1110 1000 … 00

Step 6: Rearrange the bits

1011 1111 0100 0000 … etc.

Step 7: Write as 0xBF40. Extend to eight hex digits: 0xBF40 0000.

You can follow the detailed champion study plan for GATE CS 2021 from the following link:

### Detailed GATE CSE 2021 Champion Study Plan

Candidates can also practice 110+ Mock tests for exams like GATE, NIELIT with Test Series check the following link:

### Click Here To Avail GATE CSE Test Series (100+ Mock Tests)

Get unlimited access to 21+ structured Live Courses all 112+ mock tests with Online Classroom Program for GATE CS & PSU Exams:

### Click Here To Avail Online Classroom Program For Computer Science Engineering

 Important Related Links GATE CSE Syllabus 2022 GATE CSE Question Papers GATE CSE Books 2022 GATE CSE Study Plan GATE CSE Exam Pattern GATE CSE Online Coaching 2022 GATE Study Material for CSE Data Structures & Programming

Thanks!!