Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 4

Performing addition and subtraction by computer:

Binary addition:

The method of addition, there are four cases or steps to remember before proceeding through the
operation. These are

As there no numbers other than 0 and 1 in the binary number system these four steps include all the
possible operations of addition.

A= 149 B=134

Suppose A = 10010101 and B = 10000110

To add A+B the process is

Binary subtraction:

Computers though, don’t perform subtraction; they don’t have the circuits built in that support it. Instead
they take another approach
C = A + (-B)
“Computers actually perform subtraction by adding”.
The steps are as follows.
Step 1: Calculate the Two’s Complement of our number B.
Step 2: Add the Two’s Complement of B to A to Get Our Result (C)

Suppose A = 10010101 and B = 10000110

C=A – B i.e C = A + (-B)


The signed number of B is performed by 2’s complement
Storing real numbers:
Real numbers are numbers that include fractions/values after the decimal point.
For example, 123.75 is a real number.
There are two major approaches to store real numbers. These are
1. Fixed Point Notation: In fixed point notation, there are a fixed number of digits after the decimal
point

2. Floating Point Notation: Floating point number allows for a varying number of digits after the
decimal point. This representation does not reserve a specific number of bits for the integer part or the
fractional part.

The floating number representation of a number has two parts:


1) Mantissa.
2) Exponent.
All floating point numbers are stored by a computer system using a mantissa and an exponent.
Mantissa: A mantissa is the part of a number located after a decimal point.
An example of mantissa is 75 in the number 123.75.
Exponent: This specifies the position of the decimal (or binary) point
2
An example 123.75 this can be written as 1.2375 x10
Floating -point is always interpreted to represent a number in the following form: M x re.
Where M is mantissa, r is radix (base) and e is exponent.

Consider the following example:


The number 123.75 can be represented as 1111011.11 in binary but the computer will not
store the binary number in the same way as above. It stores in the form M x re.
Represent the number 123.75 as:
2
6 25 24 23 22 21 20 0.5 0.25

1 1 1 1 0 1 1 1 1

64 + 32 + 16 + 8 + 2 + 1 + 0.5 + 0.25 = 123.75


The number created in binary is the mantissa:
111101111
To understand the exponent, place the decimal point after the most significant bit of the mantissa. The
most significant bit is the left most bit i.e 1.11101111
To calculate the exponent, it is necessary to determine how many places the decimal point would need to
move to give the correct number. In this case the decimal point would need to move six places to the
right i.e 1111011.11
So the exponent for our number is 6. In binary, the number six is i.e 110 in binary
In order to represent 123.75 the mantissa would be 111101111 and the exponent would be 110. This can
be thought of as:M X 2E (where M represents the mantissa and E represents the exponent)

1.11101111 x 2110

You might also like