Number System and Base Conversions
Number System and Base Conversions
Objective
The objective of this lab is to understand the basics of number systems, including binary, decimal, octal,
and hexadecimal systems. This manual will focus on the conversion methods between these systems,
particularly binary-to-decimal and decimal-to-binary conversions. By the end of this lab, students should
be able to convert numbers between different bases and understand the significance of each system in
computer science and engineering.
Numbers are essential for representing data in computers, whether it's text, images, sound, or any other
form of information. All data, regardless of its format, can ultimately be broken down into numbers at
the binary level.
Binary system (Base 2): Computers use binary (0s and 1s) because digital electronics, including
transistors, work with two states: on (1) and off (0). Every piece of data, from numbers to letters
and more complex information, can be represented as combinations of these two binary states.
Hexadecimal system (Base 16): It's often used as a shorthand for binary because it's more
compact. For instance, one hexadecimal digit can represent four binary digits (bits), making it
easier to express large binary numbers.
Decimal system (Base 10): This is the number system we use in everyday life. While computers
don't operate directly in decimal, humans commonly work with decimal numbers. So, converting
between binary and decimal is a key task in programming, debugging, and system design.
Octal system (Base 8): Occasionally used as a shorthand in some programming languages or for
system-level work, particularly in UNIX-like operating systems.
Number systems are closely tied to the fundamental operations of a computer. The way computers
perform arithmetic, compare values, and execute logic is rooted in binary operations.
Arithmetic operations: Addition, subtraction, multiplication, division, and even more complex
operations like floating-point arithmetic are based on number systems. These operations are
carried out using binary arithmetic and logic circuits.
Boolean algebra: Boolean operations (AND, OR, NOT) are the backbone of logic in computers
and digital circuits. These operations are based on binary values (0 and 1), making number
systems central to the execution of algorithms and decision-making processes in computers.
Computers store and manipulate data in binary format. The number systems influence how we
manage memory and allocate space.
Memory addresses: These are typically represented in hexadecimal to make them more
readable. For example, a memory address like 0x7FFF is easier to work with than its binary
equivalent.
Lab Manual: Number Systems
Data structures: Various data structures like arrays, matrices, or linked lists use number systems
for indexing, addressing, and positioning elements.
4. Computational Efficiency
Using the binary system (or its shorthand equivalents like hexadecimal) makes computation efficient
and aligned with the hardware. Converting between different number systems or directly using
binary allows computers to process data quickly and accurately without requiring complex
conversions at the hardware level.
Binary operations are naturally faster on digital circuits, which are designed to work with binary
digits. Other number systems (like decimal or hexadecimal) may require additional processing or
conversion when interacting with the hardware.
Many encoding schemes, like ASCII for text or UTF-8 for characters, convert symbols into numeric
values, and these values are manipulated using number systems.
Data encoding: Text characters are converted into binary values for storage or transmission.
Compression: Algorithms that compress data often work by grouping binary patterns or
encoding them in compact numeric forms to reduce size while maintaining data integrity.
In computer science, number systems play a critical role in error detection and correction algorithms
(like parity bits or checksums). These methods ensure that data transmitted or stored is accurate and
complete by using mathematical properties of numbers.
A number system defines a method for representing numbers using a specific set of digits or symbols.
Different number systems are used in various fields of science, engineering, and computer science. The
most common bases for number systems are:
Binary (Base-2): Uses two digits, 0 and 1, to represent numbers. This system is fundamental in
computing, as digital circuits and processors rely on binary representations.
Decimal (Base-10): Uses ten digits (0–9), which is the standard system used in everyday life.
Octal (Base-8): Uses eight digits (0–7). The octal system is sometimes used in computing,
particularly in older systems.
Hexadecimal (Base-16): Uses sixteen digits (0–9 and A–F). Hexadecimal is commonly used in
computing as a shorthand representation of binary data because each hexadecimal digit
represents four binary digits.
Lab Manual: Number Systems
Number System Base Digits
Binary 2 0,1
2.
Decimal 10 0-9
Octal 8 0-7
The binary system is based on powers of 2, using only two digits: 0 and 1. In binary numbers, each digit
(called a "bit") represents a power of 2, starting from the rightmost bit (least significant bit).
Take the binary number 1011₂. The value of each bit is given by powers of 2.
To convert a decimal number to binary, we use the method of successive division by 2, recording the
remainder each time. The binary number is the sequence of remainders, read from bottom to top.
Conversion Steps:
5. The binary number is the sequence of remainders read from bottom to top.
Step 1: 43 ÷ 2 = 21 remainder 1
Step 2: 21 ÷ 2 = 10 remainder 1
Step 3: 10 ÷ 2 = 5 remainder 0
Step 4: 5 ÷ 2 = 2 remainder 1
Step 5: 2 ÷ 2 = 1 remainder 0
Step 6: 1 ÷ 2 = 0 remainder 1
Lab Manual: Number Systems
Reading the remainders from bottom to top, the binary representation of 43₁₀ is 101011₂.
Decimal to Octal
Decimal numbers can be converted to octal by repeated division of the number by 8 while recording the
remainder. Let’s take an example to see how this happens.
47310 = 7318
Decimal to Hexadecimal
Decimal numbers can be converted to octal by repeated division of the number by 16 while recording
the remainder. Let’s take an example to see how this happens.
42310 = 1A716
Lab Manual: Number Systems
Binary to Decimal Conversion
To convert a binary number to decimal, we multiply each binary digit (bit) by 2 raised to the power of its
position (starting from 0 at the rightmost bit), and sum the products.
Conversion Steps:
5. Homework Exercises
1. 25₁₀
2. 56₁₀
3. 89₁₀
4. 112₁₀
1. 1101₂
2. 10010₂
3. 111001₂
4. 101101₂
Octal Number System (Base-8): The octal system uses eight digits: 0, 1, 2, 3, 4, 5, 6, and 7. Each place
value in an octal number corresponds to a power of 8.
Decimal Number System (Base-10): The decimal system uses ten digits: 0 through 9. Each place value
corresponds to a power of 10.
2. Expand the octal number by multiplying each digit by 8 raised to the power of its position
(starting from 0 for the rightmost digit).
(16)8 to decimal
=1x81+6x80
=8+6
= (14)10
(7777)8 to decimal
f equivalent decimal = 15
= 7 x 8 3 + 7 x 8 2 + 7 x 8 1+ 7 x 8 0
= 7 x 512 + 7 x 64 + 7 x 8 + 7 x 1
= 3584 + 448 + 56 + 7
= (4095)10
Hexadecimal to Decimal
Lab Manual: Number Systems
Introduction to Hexadecimal and Decimal Systems
Hexadecimal Number System (Base-16): The hexadecimal system uses 16 digits: 0-9 (representing values
0-9) and A-F (representing values 10-15). Each place value in a hexadecimal number corresponds to a
power of 16.
Decimal Number System (Base-10): The decimal system uses ten digits: 0-9. Each place value
corresponds to a power of 10.
2. Expand the hexadecimal number by multiplying each digit by 16 raised to the power of its
position (starting from 0 for the rightmost digit).
= 2 × 16 + 5 × 1
= 32 + 5
= 37
Home Assignment
101012
1101102
1111112
1000012
10110112
Lab Manual: Number Systems
Section E: Octal to Decimal Conversion
Convert the following octal numbers to decimal (Base-10):
478
1258
2078
648
3338
Section F: Hexadecimal to Decimal Conversion
Convert the following hexadecimal numbers to decimal (Base-10):
A516
1C316
B416
2F16
7D916
Submission Guidelines
1. Write answers neatly, showing each step for conversions.
2. Submit your assignment by the due date provided.
3. Feel free to reach out if you have any questions or need further clarification on any topic.
4. Complete this assignment by hand. Show all steps in your calculations for each
conversion.
5. After completing the assignment, convert your handwritten work into a PDF file.
6. Submit the PDF in the designated folder provided by your instructor.
Good Luck and Happy Converting!