0% found this document useful (0 votes)
6 views

Chapter 3

Uploaded by

Isanka
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views

Chapter 3

Uploaded by

Isanka
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 30

03.

Investigates how data are represented and exploits them in arithmetic and
logic operations.
Analyzes how metric data are represented in computers.
Numbers are used to express the quantitative value of something. Basic unit used to create a number can be
called a digit. All the numbers used by man are formed by digits built on symbols different from one another.

Any integer set that can represent any finite value can be called a Number System. For example, the decimal
number system is created by a set of numbers from 0 to 9.

Number systems can be used:


• To represent values • To count.
• To calculate. • To compare values.
• To arrange values in order.

When typing letters or words using the computer, these words or letters are represented by the computer as
numbers it can understand. While this group of numbers that the computer can understand is called a 'Number
System' the limited number of numerals in the number system called digits. The value of these numbers
(numerals) depends on the position they occupy within the number.

While the concept of number system was present in the 'Abacus ' considered as the first calculating machine
of the world, it has progressed up to the computer of today.

Decimal Number System


The number system extremely close to our day to day life. The decimal part and the whole part of a number
are separated by a decial point, a Plus “+” sign or negative “-“ sign is placed before it. Each number system is
made of a Unit, Number and Base / Radix.

Unit - Unit is a single object. For instance, a mango, a Rupee, and a day can be considered a unit.
Number - A number is a symbol which represents a unit or quantity.
Base / Radix - A number of symbols used in a number system is called the base/radix. The base of any
number system is indicated in decimal numbers.

Decimal Number System consists of digits from 0 to 9. Normally, the base value of decimal numbers are not
mentioned, but for the other numbers the base value has to be mentioned. The digits that are used in the
decimal number system are as follows;
Example
Let us consider how the number 25 is formed. 25 is formed with the addition of 20 and 5.

25 = 20 + 5
= ^2 « 10& ¬ ^5 « 1&
= ^2 « 101& ¬ ^5 « 100&

These positional values such as 100, 101, 102 are called Weighting Factors of decimal number system. This
number can be shown on a counting frame.

Decimal number representation of 25

2
Integer
Integers are number set. Natural numbers (0,1,2,3…) and (-1,-2,-3….) are integers. Neither decimal numbers
nor fractions are integers.
Eg: 5, 75, -85

Fixed Point Numbers


In calculations involving fixed point numbers fixed number of symbols is used after the decimal point.

Eg: 1.Integer Arithmetic 2.floating point Arithmetic

7632135 763.2135
1794821 179.4821
9426956 942.6956
.
In fixed point numbers dot( ) needs to be same place.

Floating Point arithmetic


This method is used in computing large numbers and storing. In this method, it is not necessary that the
decimal point should occupy the same position.
Eg:

The floating point numbers can be written as follows


a – decimal number
r – base / radix
e – exponent

above example 650 = 65x101


65 – Decimal number (called mantissa)
10 – base
1 – exponent

Addition of floating point values


A = 123456.7
B = 567.89
A+B=?

 First arrange both values to get same exponent.


A = 123456.7 = 1.234567 x 105
B = 567.89 = 5.6789 x 102 = 0.0056789 x 105

A = 1.2345670 x 105
B = 0.0056789 x 105
1.2402459 x 105

Binary Number System


Though we use the decimal number system when we input
numbers as data or instructions, the computer represents these
data as 0 and 1. The number system which consists of 0 and 1
is the binary number system.

3
The digits for the binary number system is given below.

Binary number
representation.

The Binary number system is very important in computing and it contributes in the representation of a bit; the
basic measuring unit of the computer. The smallest value and the highest value which can be seen in this
number system is 0 or 1 respectively. This smallest value is called Bit

Use of Binary Numbers in Computer Data Representation

Computer represents data in two signal states. There are two Voltage levels for these
two symbols. One is named as the high voltage level and the other is named as low
voltage level. ''0'' and ''1'' digits respectively represent these low and high voltage
levels in a circuit. Thus, ''1'' and ''0'' status are equal to the “On” and “Off” states of an
electronic circuit. Any data in the world can be represented on the computer using
these two digits.
According to the Figure given below, when data stored in Secondary Storage is sent to the Main Memory and
when it is sent to the Central Processing Unit from there, that data are converted to a binary code.

4
Let us consider the instance where Binary numbers
are used for computer colours. Any colour can be
made with the combination of different degrees of
red, green and blue.

These can be represented as RGB (Red, Green,


Blue) and the value of any colour ranges from 0
to 255.

For instance, if you need to use dark purple for the


background of a document, that colour can be
represented in the computer as “135, 31, 120”.
With these numbers, the colour combination for the
above colour is represented in decimal numbers.
Binary numbers for 135, 31 and 120 are
1000001112, 111112, and 11110002.

Octal Number System


The number system which uses eight digits: 0, 1, 2, 3, 4, 5, 6, 7 is called the octal number system.
Digits of the octal number system are given below.

The values such as 80,81,82,83 … are called the weighting factors of the octal number system. This number can
be represented as given below in a base eight counting frame.

Octal number representation

5
Hexa-Decimal Number System
The computer uses binary numbers and it is difficult for human beings to read them. Hence, the hexadecimal
number system is used as it is easier for humans to use. Normally, calculations are performed using the ten
fingers of the hands. Just imagine you have sixteen fingers on your hands. Then you can use sixteen numbers
to count. In the hexadecimal number system, ten digits are used from 0 to 9 and for the other 6 digits, A, B, C,
D, E and F symbols are used. Here, A, B, C, D, E and F are used to represent 10, 11, 12, 13, 14 and 15.

When F the largest number of hexadecimal number system, is expressed in binary form, it can be indicated
with 4 Bits. Thus, instead of using a binary number with 4 Bits, a single number in hexadecimal number
system can be used. For example, Hexadecimal numbers are used to represent memory addresses of the
computer.

You can see code “# 871F78” related to the dark purple colour shown in Figure 3.4. Here the value of the
colour is started with “#” symbol. The colour value is indicated in the computer in hexa decimal numbers.
Thus, the code for dark purple in the above example is “# 871F78”. R,G,B values of this can be indicated
from 0 to 255 in decimal numbers. If “#’ or “&H” (ampersand) symbol is used in front of the value of any
value, it is a hexa decimal number. Given below in Table are the hexa decimal values and RGB values of dark
purple colour.

Here, 160, 161, 162, 163….. values are called Hexadecimal


Weighting Factors.

This number can be represented on a sixteen base counting frame


as below.
Sixteen base number representation

6
Relationship among Decimal, Binary, Octal and Hexadecimal

Most and Least Significant Positional Value of a Number

There are two seperate methods to find the most and least significant values of decimal numbers and whole
numbers. When a whole number is read from left to right, the number in the right most end is the least
significant positional value and the number in the left most end which is not 0 is the most significant
positional value.

In decimal numbers, the value in the right extreme after the


decimal point which is not 0 becomes the least significant
positional value and the number in the left extreme of the
decimal point which is not 0 becomes the most significant
positional value.

Most Significant Digit (MSD) and Least Significant Digit (LSD)


Given below in Table are the most and least significant digits of a round figure or a decimal number.

You can use the same method


used for the decimal number
system to find the most and least
significant positional digits of
binary, octal and hexadecimal
numbers.

7
Activity
Find the most significant digit and the least significant digit of the following numbers.
(i) 5687010 (ii) 154.0110 (iii) 23.0808 (iv) AD 23916 (v) 0.001102

Most Significant Bit (MSB) and Least Significant Bit (LSB)

Only the Binary Number System is used to find the most significant bit (MSB) and the least significant
bit(LSB). There are two ways to find this using decimal numbers and whole numbers.

In a whole number, read from left to right, the value in the right extreme is the least significant bit and the
value in the left extreme which is not 0 is the most significant bit. In binary decimal numbers, the value in the
right extreme of the decimal point which is not 0 is the least significant bit and the value in the left extreme of
the decimal point which is not 0 is the most significant bit.

Activity
Find the most significant bit and the least significant bit of the following numbers.
(i) 10002 (ii) 0111012 (iii) 0.110012 (iv) 1.00102 (v) 0.001102

Converting Decimal Numbers to Binary, Octal and Hexa-Decimal Numbers

Conversion of Decimal numbers to numbers of other bases

All the data we input to the computer is taken by it as digits of binary number system; 0 and 1. Hence, the
knowledge to convert a base ten number to another base is important. Here in this chapter, conversion of a
decimal number to a binary number, octal number and a hexadecimal number is discussed.

8
Conversion of Decimal Numbers to Binary Numbers

When a decimal number is converted to a binary number, the decimal number can be divided by two until the
remainder is 0 and the remainder of the division can be written on the right side. After that, write all the
remainders from the bottom to top to build the number.

Activity
Convert the following decimal numbers
to binary numbers.
(i) 15510 (ii) 47210 (iii)116310

Converting Decimal Numbers to Octal Numbers


Here, divide the given number by 8 until the remainder is 0 and write the remainders from bottom to top.

Activity

Convert the following decimal numbers to octal numbers.


(i) 15510 (ii) 47210 (iii) 116310

9
Converting Decimal Numbers to Hexadecimal Numbers
Here, divide the number by 16 until the remainder is 0 and write down the remainders from bottom to top.

Activity

Convert the following decimal numbers to hexadecimal numbers.


(i) 25610 (ii) 47810 (iii) 196310

Converting Binary Numbers to Decimal Numbers

10
Activity

Covert the following binary numbers to decimal numbers.


(i)1012 (ii) 1110101102 (iii)10100101112

Converting Binary Numbers to Octal Numbers

From the digits used in the octal number system; 0, 1, 2, 3, 4, 5, 6, and 7, the largest digit is 7. We can
indicate digit 7 as 1112 in binary form. Thus 7; the largest digit in the octal number system, can be indicated in
a binary form with 3 digits. Likewise all the digits in the octal number system can be indicated in the three
digit binary form. Given below in Table are the binary forms of the digits used in eight base (octal) number
system.

As per the above table, three bits are used when indicating an octal number in binary form. (8 = 2 3)
Let us consider how a binary number is converted to an octal number.

Example
Converting 10111012 to an octal number.
 First, divide the number into three bits from the right corner to the left corner. If the last cluster in the
left corner does not consist of 3 bits, add 0s to complete.
 Write each octal number separately for each cluster.
 Then write these clusters in octal digits.
 Write these digits in order from the left corner to the right corner.

Activity

Convert the following binary numbers to octal


numbers.
(i) 100110012 (ii) 1111001112 (iii) 101010101102

11
Converting Binary Numbers to Hexadecimal Numbers

From the symbols used in the hexadecimal number system, the value represented by “F” possesses the largest
numerical value. This can be indicated as a four-bit binary number; 11112. Thus, all the digits in the
hexadecimal number system can be indicated as four-bit binary numbers. Given below in Table are the binary
numbers for the digits used in the hexadecimal number system.

As shown in the table above Table, four bits are used to indicate a hexadecimal number in binary form. (16 =
24)

Example
Converting number 101102 to a hexadecimal number.
• First, divide the number into four-bit clusters from the right corner to the left corner.
• Write hexadecimal numbers separately for each cluster.
• Write these numbers in order from the left corner to the right corner and write down the base.

12
Example
Converting number 101110111002 to a hexadecimal number.

Activity

Convert the following binary numbers to hexadecimal numbers.


(i) 110110102 (ii) 111110011012 (iii) 100111000112

Converting Octal Numbers to Decimal Numbers

Activity
Convert the following octal numbers to decimal numbers.
(i) 2308 (ii) 7458 (iii) 20658

13
Converting Octal numbers to Binary Numbers

We have learned above that an octal number can be indicated in three digits when it is converted to a binary
number. Thus, each digit in octal numbers should be written in three digits when it is converted to base two.

Example
Converting number 4578 to a binary number.
 Firstly, write each digit in octal number in three bits.
 Secondly, write down all the bits together to get the binary number for the octal number.

Activity

Convert the following octal numbers to binary numbers.


(i) 108 (ii) 2458 (iii) 7068

Converting Octal numbers to Hexadecimal Numbers

Example
Converting number 10578 to a hexadecimal number.
• First, write each digit in octal number in three bits.
• Divide the binary number you get into four-bit clusters from the right corner to the left corner.
• Write the related hexadecimal number for each cluster.

Activity

Convert the following octal numbers to hexadecimal numbers


(i) 3208 (ii) 4758 (iii) 16738

14
Converting Hexadecimal Numbers to Decimal Numbers

Activity

Convert the following hexadecimal numbers to decimal numbers


(i) 1A16 (ii) 7EF16 (iii) A4916

Converting Hexadecimal Numbers to Binary Numbers

You have learnt earlier that any symbol in a hexadecimal number can be written in a four-bit binary number.
Thus, when a hexadecimal number is converted to a binary number, each digit in that number should be
indicated in a four-bit binary number.

15
Activity
Convert the following hexadecimal numbers to binary numbers.
(i) 7816 (ii) B2C16 (iii) 4DEF16

Converting Hexadecimal Numbers to Octal Numbers

First, the hexadecimal number should be converted to a binary number and then it should be converted to an
octal number.

Activity

Convert the following hexadecimal numbers to octal numbers.


(i) 32016 (ii) A7B16 (iii) 10ED16

Activity

1. Consider number “23y”. Here, ‘y’ is the base of the number system. From the number systems you have
learned, as to which number system “23y” belongs.
2. Convert the decimal number 8310 to a binary number. Show steps.
3. Convert the binary number 101101112 to an octal number. Show steps.
4. Convert the hexadecimal number 23D16 to a binary number.
5. Fill in the blanks in the table given below.

16
Conversions between number systems

1. Conversion of a binary number into a decimal number.


110101.112 Decimal

By adding all the numbers after multiplying each and every digit in the binary number with its relevant
place value, the corresponding decimal value of that number is found.

2. Conversion of a Octal number into a decimal number


237.048  Decimal

3. Conversion of a Hexadecimal number into a decimal number


1AB216 Decimal

4. Conversion of Decimal Fractions to binary


a. Multiply the given decimal fraction by 2.
b. Multiply by 2 until the decimal part becomes 0.
c. Write the values in front of decimal point from beginning to end.

5. Fractions to Octal
a. Multiply the given decimal fraction by 8.
b. Multiply the decimal by 8 until it becomes 0.
c. Write from the beginning to end, the values in front of the
decimal point.

6. Conversion of fraction octal numbers into binary numbers


 The binary value of every octal number from 0 to 7 can be written in three digits.
 When the binary value of every digit in an octal number in three digit is substituted, it is converted
into the binary number of that octal number.
 128 = 001,0102
65.128 = (110,101.001,010)2

17
7. Conversion of a binary number into a octal number
 First, beginning from the decimal point of the binary number from groups of three numerals each
starting from the decimal point moving left.
 If a group has less than three numerals add a “0” in front to form a group of three numerals.
 In making the fractional part octal, form groups of three numerals each, moving right from the
decimal point.
 If the number of numet=rals in a group is less than three add a “0” to the end complete the group.
 Write the octal number relevant to each group.

8. Conversion of Hexadecimal numbers into binary numbers


 Every hexadecimal number 0 to 15 can be written in four binary numbers.
 When the binary value of every digit in a hexadecimal number written in four digit is substituted, it is
converted into the binary number of that hexadecimal number.

9. Conversion of Binary numbers into hexadecimal numbers


 First, group the binary numbers into groups of four digits each, starting from the decimal point and
moving left.
 If the number of numerals in a group is less than four, place a “0” in front and form a group of four.
 In converting fractional part into hexadecimal numbers, form groups of four, starting from decimal
point and moving right.
 If the number of numerals in a group is less than four place a “0” behind and form the group.
 Write the decimal number relevant to each group.
 Afterwards, write the decimal numbers in hexadecimal numbers.

3.2 Analyses how character data are represented in computers.

Data you enter to the computer and computer data representation

18
According to the above figure, when you enter a data to the computer, it converts the data to different patterns
made of 0 and 1. Thus, binary codes are used when storing numeric, alphabetic, special character, images and
sounds in internal storage devices of computers.

In the beginning of the lesson, when you type ‘A’ on the keyboard, the code you get for ‘A’ is the bits pattern
1000001 (the binary code of letter ‘A’). The number of bits used is 7. Thus, a combination made of a bit
pattern is used to represent each data and the bits used for each code is different. Following are
different coding systems used.

1. BCD Binary Coded Decimal


2. ASCII American Standards Code for Information Interchange
3. EBCDIC Extended Binary Coded Decimal Interchange Code
4. Unicode

BCD - Binary Coded Decimal

This coding system was used in the early stages of computing. In this system one digit is represented by 4
bits. This is used only to represent decimal numbers. Sixteen symbols (24 = 16) can be represented in this
system. The blow table shows the BCD codes for the 10 digits from 0 to 9.

Activity
Write the BCD values for the decimal values given below.
(i) 302 (ii) 2136 (iii) 17295

ASCII – American Standard Code for Information Interchange

Initially ASCII coding system used 7-bit binary digit. 128 characters can be represented using this coding
system. ASCII is used to represent text.

ASCII system is designed and approved by ANSI (American National Standard Institute).

Example
• Text
When the word ‘School’ is entered into the computer through the keyboard, write down how it is understood
by the computer.
 First, write the decimal numbers for the symbols.
S - 83 c - 99 h - 104 o - 111 l – 108

 Write binary numbers for each value.


S - 1010011 c – 1100011 h - 1101000 o – 1101111 l - 1101100

19
 Write the associated code
S c h o o l
101001111000111101000110111111011111101100

Activity

Write down the ASCII code of “ICT” in binary numbers.

EBCDIC – Extended Binary Coded Decimal Interchange Code


We can write only 128 characters using ASCII system, but the EBCDIC code system allows the use of 256
characters. Here, one symbol can be written with a binary number which consists of 8 bits. Hence, 256
characters can be represented using this system. This system was used in IBM main frame computers. The
table below shows that there are different EBCDIC codes for the 26 different capital letters and 26 different
EBCDIC codes for the 26 simple letters in this system.

Unicode System

Though 128 characters can be used in the


ASCII system and 256 characters can be
used in the EBCDIC system for data
representation. For example, these systems
cannot be used for Sinhala, Japanese,
Chinese and Tamil languages as there are
more than 256 characters. Hence Unicode
system was designed according to a standard
to represent 65536 different symbols of 16
bits (216 = 65536).

As per the figure given below, shows the


Unicode system can be used to represent
Sinhala and Tamil letters, and special
symbols and picture symbols.

Unicode system uses unique number for each


number, text or symbol in any or Operating
System.

Occasions Unicode are used

20
Example
 Picture and Graphic Data
Given below is a close up or a highly enlarged image of
photograph. A photograph consists of pixels (dots) made
of different colours in big grid. Computer graphic data
such as pictures, frames of a movie or frames of an
animation consist of various colours. The picture given
below consists of a number of different colours.

Colours in a picture and their binary values.

 Sound
As shown in the figure below is the sound emitted from a speaker is normally represented as analog waves.
However, all data in computer are digital data and those are made of bytes. Hence, sound which comes as a
analog data is converted to a digital data. Thus, a sound is also represented in a bits pattern made of 0s and 1s
in a computer.

Conversion of analog data of a sound to digital data

By this coding system, codes are classified to represent characters of all the international languages. The
institution which initiated is the International Standard Institution and Unicode Consortium. Unicode is
largely used in designing websites and newspapers.

Activity
1. If ‘A’ character is represented as 1000001 in ASCII system, what is the ASCII code for letter ‘F’?
2. What is the largest number presented in BCD (Binary Coded Decimal)?
3. What is the minimum number of bits required to present a hexadecimal number?
4' If 10000102 represents “B” in ASCII code, what is the ASCII code for letter “L”?
5. What are the coding systems used in computers? Explain the need to use such coding systems.

21
ASCII and EBCDIC codes for characters and related decimal, octal and hexadecimal numbers

22
23
ASCII and EBCDIC values related to letters - Unicode for Sinhala and Tamil letters

24
Uses basic arithmetic and logic operations on Binary, Octal and Hexadecimal numbers.
In number system basic operators are addition, subtraction, multiplication and division. For these operators
always used decimal number system as same as other number systems can use these operators. The most
important thing is to understand the number system and nature of the base value. That means the maximum
value and the movements to the next weighting point.

Eg:

Consider the step by step in above decimal arithmetic calculation.

1. 7 + 5 = 12, here two ones’ set and one tens’ set are included. This two ones’ set is placed in 100th
weighting point and one tens’ set goes to next weighting point 101 as 1.
2. 6 + 8 =14 and that one tens’ set is 15 now. Here also one tens’ set and remainder is 5. This remainder
5 placed to 101 and one tens’ set goes to next weighting point 102 as 1.

Like above example always if tens’ set are available, that goes to next weighting point (left side) and
remainder is placed in the same position.

In here tens’ set are taken because 10 base number system used for the calculations. If the base is 8 eights’ set,
base is 2 twos’ set and base is 16 sixteens’ sets needs to calculations.

In binary calculations twos’ sets, octal calculation eights’ sets and hexadecimal calculations sixteens’ sets
need to be placed to left side.

Octal Addition Octal Subtraction

Exercise

1. Addition below numbers

2. Subtract below numbers

Basic Binary Value Operators

Binary Addition

Addition of binary values same as adding decimal values. In binary number system, one place maximum
value is 1. If adding value is more than 1 that value goes to the left hand place. There are four main situations.

02 + 02 = 02 02 + 12 = 12 12 + 02 = 12 12 + 12 = 02

25
Situation A + B Addition Carry
1 0 + 0 0 0
2 0 + 1 1 0
3 1 + 0 1 0
4 1 + 1 0 1

Eg: Remainder

Binary Subtraction

Subtraction of binary number same as decimal subtraction, big value subtract by small value from left side
need to borrow a one bit. There are four main situations here.

02 - 02 = 02 02 - 12 = 02(borrow 1 bit from left) 12 - 02 = 12 12 - 12 = 02

Situation A - B Subtraction Borrow


1 0 - 0 0 0
2 0 - 1 0 1
3 1 - 0 1 0
4 1 - 1 0 0

Eg: (Borrow 1 bit from left)

Binary multiplication

Multiplication of binary values same as decimal values. In here always 0 and 1 is coming as answer. There are
four main situations.

Situation A x B Answer
1 0 x 0 0
2 0 x 1 0
3 1 x 0 0
4 1 x 1 1

Binary Division

Division of binary values same as decimal values. This method is long method of division.

26
I computer programming, bit wise operation, depending on one bit or more or binary values single bit
operations can be processing.

Bitwise AND operation

Logic AND operation is processing with two binary values. Eg:

Bitwise OR Operation

Logic OR operation is processing with two binary values.

Bitwise NOT Operation

Logic NOT operations is processing and get the invert of the number.

if the x is a number, result of NOT operation is always –(x+1).

Bitwise XOR Operation

XOR operation is doing by Equal number two binary values.

Analyses how signed numbers are represented in computes and uses standard methods
to represent floating point numbers.
Signed Numbers

Up to here we have learnt unsigned numbers addition, subtraction and convert other base. It is very easy to
operate unsigned numbers but for the signed number representation need special procedure. The memory
range of the signed numbers in computer programs allocated one bit for the sign (+/-). This allocated bit is the
first bit, which considered as a most significant bit. When this bit becomes 1, the numbers is negative (-) value
number. When this bit becomes 0, the numbers is positive (+) value number. Other bits represent the value of
the number.

There are 3 ways generally used:

1. Signed Magnitude.
2. One’s Complement.
3. Two’s Complement.

Signed Magnitude.

Signed magnitude system, first bit is taken as sign and other bits are taken as numbers.

Eg: 8 bits word -1 and +1

-1 = 10000001

+1 = 00000001

To store signed magnitude in a computer is used this 8 bit method. According to this maximum number is

27
27-1 (127)

01111111 – first number 0 remaining 7bits1

Minimum number is -127

1111111 – all 8bits 1

Computer can do calculations using this method of numbers, but this method is not convenient method for all
times.

When calculating minus values adding all and put it as a minus (eg:-2 + (-3) = -5). But, when numbers are
having unequal signs, it is difficult to select the highest value. To solve this problem without getting sign
calculations are done. Then sign bit needs to place as first bit of the number.

N 8 bits number important rule is the value has only 7 bits. If 7th bit number comes to 8th bit that no need to
take.

Eg:

These numbers written as signed magnitude like, 010011112 + 001000112 = 011100102. The signed bit of
these numbers is 0. Above example is done as same as decimal calculations. But, after calculating 7th bit if the
value goes to 8th bit the value not used.

Because 8th bit represent sign bit. In this situation that bit considers as positive over flow and not write in the
first. Otherwise answer can be seen wrong.

Below Example Consider subtraction

Not consider 8th bit

Here answer is wrong.

Signed Magnitude

Signed Bit

Below example signed has been changed

Signed bit is 1 value minus (-)

28
One’s Complement

Binary number one’s complement is invert of the number.

Eg: 10101 one’s complement is : 01010.

This method s very easy and from the hardware can easily change according to the one’s complement. And
easily get minus values. For the representation of the sign need not to keep bit. From one’s complement can
take binary number minus value and if the result MSB is 0 the value could be positive and no need to take
inverter. If the MSB is 1 that should be taken negative value.

Eg: 23 and -9 can write as 8 bits numbers

23 = + (00010111) = 00010111

-9 = - (00001001) = 11110110 (one’s complement)

Here without 9 subtract 23, -9 add into 23. 23 can write as same it is and 9 needs to convert one’s
complement.

- One’s Complement

One’s Complement

Last front bit adding

Eg:

Complement

Here discuss the value of 111100012 is -14.

MSB is 1 then it is minus value. Complement is 000011102.

11110001 complement 00001110 = 14.

Two’s Complement

9 and -23 numbers adding using two’s complement.

29
Eg: 23 and -9 adiing using two’s complement

(9’s two’s complement)

Floating point values representation


There are 3 parts in floating point number.

Signed bit

Exponent

Fractional part

Combining these 3 parts14 bits structure is used in floating point values.

Signed bit – 1 bit 1 bit 5 bits 8 bits


Exponent – 5bits Signed Exponent Fractional Part
Bit
Fractional part – 8 bits

Decimal number 17 in floating point value

17 = 17x100 = 1.70x101 = 0.17x102…. can be written as this.

Binary number also can be written as this method.

17 = 100012 x 20 = 1000.12 x 21 = 100.012x22 = 10.0012x23 ……

According to above example 17 can be written as 0.10001x25. Signed bit of this is zero(0). Because of the
number is positive value.

Exponent is 5 = 00101 and

Fractional part is 10001000. signed bit exponent fractional part

According to this method big numbers can be represent as floating point expression.

Eg: 655536 = 0.1x217

Signed bit exponent fractional part

30

You might also like