Professional Documents
Culture Documents
Data Representation?
Representation = Measurement
§ Most things in the “Real World” actually exist as a single, continuously varying
quantity
§ Mass, Volume, Speed, Pressure, Temperature
§ Easy to measure by “representing” it using a different thing that varies in the same
way
§ Eg. Pressure as the height of column of mercury or as voltage produced by a pressure
transducer
§ These are ANALOG measurements
Digital Representation
§ DIGITAL measurements
§ In units - a set of symbolic values – digits
§ Values larger than any symbol in the set use sequence of digits
§ Units, Tens, Hundreds
§ Measured in discrete or whole units
Number Systems
§ Computers uses binary system in their internal operations, as they are built from
binary digital electronic components.
§ However, writing or reading a long sequence of binary bits is cumbersome and
error-prone.
§ Hexadecimal system is used as a compact form or shorthand for binary bits.
Hexadecimal (base 16)
INTRODUCTION TO COMPUTERS
Base-n to Decimal
Binary 1 0 1 1 0
(base-2) 1x24 + 0x23 + 1x22 + 1x21 + 0x20
16 + 0 + 4 + 2 + 0 = 2210
Octal 7 5 1 2
(base-8) 7x83 + 5x82 + 1x81 + 2x80
3584 + 320 + 8 + 2 = 391410
Hexa A 3 E
(base-16) Ax162 + 3x161 + Ex160
2560 + 48 + 14 = 262210
Base-n to Binary
22 / 2 11 0
11 / 2 5 1
5/2 2 1
1/2 0 1
Base-n to Binary
7 5 1 2
111 101 001 011
75128 = 1111010010112
Base-n to Binary
A 3 E
1010 0011 1110
A3E16 = 1010001111102
Base-n to Octal
3914 / 8 489 2
489 / 8 61 1
61 / 8 7 5
1010001111102 = 50768
Base-n to Hexadecimal
2622 / 16 163 E
163 / 16 10 3
10 / 16 0 A
262210 = A3E16
Base-n to Hexadecimal
1111010010112 = F4B16
Octal to Hexadecimal and vice versa
Octal to Hexadecimal
1. Convert octal to binary
2. Convert binary to hexadecimal
Hexadecimal to Octal
1. Convert hexadecimal to binary
2. Convert binary to octal
Arithmetic Operations (Base 2)
INTRODUCTION TO COMPUTERS
Example: Base 2 (Binary)
First Second
Operator Result
Number Number
110 1011 + 11 1001 1010 0100
1 1001 - 1011 1110
11 1001 x 110 1 0101 0110
110 1110 / 1010 1011
*observe demo for detailed solution