Chapter Two
Chapter Two
Chapter Two
Data Representation
1
Outlin
e
Bits, bytes, and words
Numeric data representation and number bases
Fixed- and floating-point systems
Signed and twos-complement representations
Data types
Representation of nonnumeric data (character codes, graphical data)
Representation of records and arrays
2
Introduction
In Digital Computer, data and instructions are stored in computer memory
using binary code (or machine code) represented by Binary digIT’s 1 and 0
called BIT’s.
The data may contain digits, alphabets or special character, which are
converted to bits, understandable by the computer.
The number system uses well defined symbols called digits
Number systems are basically classified into two types. They are:
Non-positional number system
Positional number system
3
Number systems
a. Non-positional number system
In olden days people use of this type of number system for simple
calculations like additions and subtractions.
The non-positional number system consists of different symbols that are
used to represent numbers.
E.g. Roman number system, I=1, V=5, X=10, L=50.
This number system cannot be used effectively to perform arithmetic
operations
b. Positional Number System
This type of number system are:
Decimal number system Octal number system
Binary number system Hexadecimal number system 4
Number systems
b. Positional Number System
The total number of digits present in any number system is called its Base or
Radix.
Every number is represented by a base (or radix) x, which represents x digits.
The base is written after the number as subscript such as
It is a Decimal number as its base is 10.
To determine the quantity that the number represents, the number is multiplied
by an integer power of x depending on the position it is located and then finds
the sum of the weighted digits.
E.g. Consider a decimal number which can be represented in equivalent value
as: 5x102 + 1x101 + 2x100 + 4x10-1 + 5x10-2
5
Positional Number System
6
Positional Number System…
1
0
NumberSystem Conversions
Convert from Binary to Decimal, Octal and Hex
0 0 0 0
0 1 1 1
1 0 1 0
1 1 0 0
Binary Arithmetic …
Binary Subtraction
When we subtract 1 from 0, it is necessary to borrow 1 from the next left
column i.e. from the next higher order position
E.g. Subtract the following number
a) 10 from 14 b) 9 from 29 c) 3 from 5
If the signs differ, we need to subtract the smaller magnitude from the
larger magnitude, and keep the sign of the larger magnitude
Representation of Singed Integers…
1’s Complement representation
This is the simplest method of representing negative binary number.
The 1’s complement of a binary number is obtained by changing each 0 to
1 and each 1 to 0.
In other words, change each bit in the number to its complement.
Example 1: Find the 1’s complement of 101000.
1’s complement
Add 1 to LSB
2’s complement
Bit Models…
2’s Complement …
To determine the magnitude of a negative number, we perform the exact same
steps:
11101101 = -19
00010010 flip bits
00010011 add one
Ee.00010011
Find the= 1’s
19 magnitude
and 2’s complement of 1011101.