# Computer Arithmetic Study Notes for GATE CS Exam

By BYJU'S Exam Prep

Updated on: September 25th, 2023

Computer Arithmetic is a fundamental topic in the field of computer science, particularly for those aspiring to take the GATE CS exam. It focuses on the study of numerical representation, manipulation, and computation within a computer system. When preparing for the GATE CS exam, having comprehensive study notes on computer arithmetic is essential. These study notes provide a concise and organized overview of the key concepts and techniques used in performing arithmetic operations on computers.

The study notes serve as a valuable resource for GATE CS aspirants, offering clear explanations, examples, and practice problems that help reinforce the understanding of complex concepts. By mastering computer arithmetic, candidates can develop a strong foundation in computational mathematics and improve their problem-solving skills.

Table of content

## Computer Arithmetic Study Notes

**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 × 10^{1}.

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 (2^{n-1 }– 1), and the negative lowest number is –(2^{n-1} – 1).

## Actual Number Finding Technique

Here, we always store the exponent as 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. The given formula can calculate the actual number from the contents of the registers.

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

m = Mantissa value of register

S = Sign bit

e = Exponent value of register

The bias number of n bits is used to represent the exponent, then

Bias number will be equals(2^{n–1} –1)

The range of exponent is –(2^{k–1} –1) to 2^{k–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

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, and NAN (not-a-number).

## Ranges of Normalized numbers using single precision

The representation format of a normalized number is:

(–1)^{S}. M . 2^{E}, 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}) × 2^{127}**, minutely less than 2

**×**2

^{127}= 2

^{128}which is equivalent to 3.4

**×**10

^{38}.

The range for positive normalized numbers in this format is 1.2 **×** 10^{–38} to 3.4 **×** 10^{38}.

## 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, and 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 0xBF40. Extend to eight hex digits: **0xBF40 0000**.

Important Related Links | |

**Download Byjus Exam Prep App**** for the best Preparation**