number system & data representation
TRANSCRIPT
NUMBER SYSTEMS & DATA
REPRESENTATIONSFUNDAMENTALS OF COMPUTER & PROGRAMMING (COMP 1)
PREPARED BY: PHILLIP GLENN LIBAY
NUMBER SYSTEM
Is a method of expressing values, using a set of symbols in a consistent manner.
Several number systems has been used in the past which can be categorized into two (2): positional and non-positional number systems.
POSITIONAL NUMBER SYSTEM
In a positional number system, the position the symbol occupies determines the value it represents, thus, it is also often called the PLACE VALUE system.
DECIMAL NUMBER SYSTEM
• Is a number system with the base of 10.
• It uses ten (10) unique symbols to represent values.
0 1 2 3 4 5 6 7 8 9
• n = 3, b = 10
• The equivalent decimal number is One Hundred Twenty Three
Example 1.a - Decimal Number System, Positional Values
BINARY NUMBER SYSTEM
• Is a number system with the base of 2.
• It uses two (2) unique symbols to represent values.
0 1
• n = 4, b = 2
• The equivalent decimal number is Nine
Example 1.b - Binary Number System, Positional Values
OCTAL NUMBER SYSTEM
• Is a number system with the base of 8.
• It uses eight (8) unique symbols to represent values.
0 1 2 3 4 5 6 7
• n = 3, b = 8
• So the equivalent decimal number is Eighty Seven
Example 1.c - Octal Number System, Positional Values
HEXADECIMAL NUMBER SYSTEM
• Is a number system with the base of 16.
• It uses sixteen (16) unique symbols to represent values.
0 1 2 3 4 5 6 7 8 9 A B C D E F
• n = 3, b = 16
• So the equivalent decimal number is Two Hundred Eighty One
Example 1.d - Hexadecimal Number System, Positional Values
Decimal Binary Octal Hexadecimal
0 0 0 0
1 1 1 1
2 10 2 2
3 11 3 3
4 100 4 4
5 101 5 5
6 110 6 6
7 111 7 7
8 1000 10 8
9 1001 11 9
10 1010 12 A
11 1011 13 B
12 1100 14 C
13 1101 15 D
14 1110 16 E
15 1111 17 F
START
Create an empty destination (v).
Divide the source (s) by the destination base (b).
Insert the remainder at the destination (v).
STOP
The quotient becomes the new source (s).
TRUE
FALSECondition: Is the quotient zero?
Given: s = Source Numberb = Destination Base
Return: v = Destination Value
Figure 1.a - Conversion from Decimal to any Base (Integral Part)
Example 1.e - Decimal to Binary Conversion (Integral Values)
Convert the number to binary.
Results:
13
61 30
1011
Source
Destination
Example 1.f - Decimal to Octal Conversion (Integral Values)
Convert the number to octal.
Results:
12615
0 1
671
Source
Destination
Example 1.g - Decimal to Hexadecimal Conversion (Integral Values)
Convert the number to octal.
Results:
12670
E7
Source
Destination
START
Create an empty destination (v).
Multiply the source (s) by the destination base (b).
Insert the integral part at the destination (v).
STOP
The fractional part becomes the new source
(s).
TRUE
FALSECondition: Is the fractional part zero?
Given: s = Source Numberb = Destination Base
Return: v = Destination Value
Figure 1.b - Conversion from Decimal to any Base (Fractional Part)
Example 1.h - Decimal to Binary Conversion (Fractional Values)
Convert to Binary.
Results:
0.625 0.25 0.50 0.00
1 0 1
Example 1.h - Decimal to Octal Conversion (Fractional Values)
Convert to Octal.
Results:
0.634 0.072 0.576 0.608
5 0 4
Example 1.h - Decimal to Hexadecimal Conversion (Fractional Values)
Convert to Hexadecimal.
Results:
0.64 0.24 0.84 0.44
A 3 D
Figure 1.c - Binary to Octal Conversion
Binary Digit
Octal Digit
𝐵𝑚 𝐵𝑚−1 𝐵𝑚−2 𝐵5 𝐵4 𝐵3 𝐵2 𝐵1 𝐵0…
𝑂𝑚𝑂1 𝑂0