Categories

# Data Representation

Two categories of number systems are:
a) Non-positional number systems (Roman and Greek number systems)
b) Positional number systems (Binary, Octal, Decimal, Hexadecimal number systems)

Positional number system is also known as place-value number system.

The base or radix tells the number of distinct graphic symbols used to represent numbers in a given number system.

The binary number system has base 2 as it supports 2 symbols: 0 and 1.
The octal number system has base 8 as it supports 8 symbols: 0, 1, 2, 3, 4, 5, 6, 7.
The hexadecimal number system has base 16 as it supports 16 symbols: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F.

LSD: Least Significant Digit
MSD: Most Significant Digit
LSB: Least Significant Bit
MSB: Most Significant Bit

There are two ways of representing integers in binary:
a) Unsigned integers (can represent 0 and positive integers)
b) Signed integers (can represent, 0, positive and negative integers)

An unsigned integer containing N bits can have a value in the range 0 to 2N – 1.

There are three ways of representing signed integers:
a) Sign-magnitude representation
b) 1’s complement representation
c) 2’s complement representation

In sign-magnitude representation, the MSB is the sign bit, with 0 indicating positive and 1 indicating negative. The remaining bits represent the magnitude of the integer.

Drawbacks of sign-magnitude representation:
a) There are two representations for the number zero.
b) Positive and negative integers need to be processed separately.

1’s complement is calculated by replacing every 0s with 1s and vice-versa.

Drawbacks of 1’s complement representation:
a) There are two representations for the number zero.
b) Positive and negative integers need to be processed separately.

2’s complement is calculated by adding 1 to its 1’s complement.

a) There is only one representation for the number zero.
b) Positive and negative integers can be treated together.

Following are the various ways for representing floating point numbers in binary:
a) Fixed-point representation: It splits the bits for representing number to the left of the decimal point and number to the right of the decimal point.
b) Scientific notation: The number is represented by using mantissa, base and exponent.
1.02 × 2-1
c) Normalized scientific notation: In this method, only a single non-zero digit before the radix point is used.
d) Mantissa-exponent notation: In this method, a floating-point binary number is represented in the following form:
Mantissa × 2exponent
e) Excess notation: It is a means of representing both positive and negative numbers such that the order of the bit patterns is maintained.

Mantissa is also sometimes referred to as significand.

Single precision numbers include an 8-bit exponent field and a 23-bit fraction, for a total of 32 bits.
Double-precision numbers include an 11-bit exponent field and a 52-bit fraction, for a total of 64 bits.

0 + 0 = 0
0 + 1 = 1
1 + 0 = 1
1 + 1 = 10
1 + 1 + 1 = 11

Binary subtraction:
0 – 0 = 0
1 – 0 = 1
1 – 1 = 0
10 – 1 = 1
0 – 1 = 1 with a borrow of 1

Binary multiplication:
0 × 0 = 0
0 × 1 = 0
1 × 0 = 0
1 × 1 = 1

Binary division:
0 ÷ 1 = 0
1 ÷ 1 = 1

8’s complement is found by first taking 7’s complement and then adding 1 to it.
16’s complement is found by first taking 15’s complement and then adding 1 to it.

ASCII stands for American Standard Code for Information Interchange. It is a 7-bit code, used for representing characters.
EBCDIC stands for Extended Binary Coded Decimal Interchange Code. It is an 8-bit code for representing various symbols.
Unicode is a 16-bit code that can represent characters from multiple languages.
ISCII stands for Indian Standard Code for Information Interchange. It is an 8-bit code that offers coding for Indian scripts, apart from ASCII characters.