[go: up one dir, main page]

0% found this document useful (0 votes)
26 views9 pages

Number System and Base Conversions

Uploaded by

ayaz.farid
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
26 views9 pages

Number System and Base Conversions

Uploaded by

ayaz.farid
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 9

Lab Manual: Number Systems

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.

1. Representing Data Efficiently

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.

2. Logical and Arithmetic Operations

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.

3. Memory and Storage

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.

5. Encoding and Compression

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.

6. Error Detection and Correction

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.

1. Introduction to Number Systems

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

Hexadecimal 16 0-9, A-F

Binary Number System

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).

Example: Converting a Binary Number to Decimal

Take the binary number 1011₂. The value of each bit is given by powers of 2.

Thus, the binary number 1011₂ is equal to 11₁₀ in decimal.

Decimal to Binary Conversion

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:

1. Divide the decimal number by 2.

2. Write down the remainder (0 or 1).

3. Continue dividing the quotient by 2, recording the remainders.

4. Stop when the quotient is 0.

5. The binary number is the sequence of remainders read from bottom to top.

Example: Convert 43₁₀ to Binary

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.

Reading the remainders from bottom to top,

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.

Reading the remainders from bottom to top we get,

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:

1. Start from the rightmost bit (position 0).

2. Multiply each binary digit by 2 raised to the power of its position.

3. Sum all the products to get the decimal value.

Example: Convert 101011₂ to Decimal

5. Homework Exercises

5.1 Decimal to Binary Conversion

Convert the following decimal numbers to binary:

1. 25₁₀

2. 56₁₀

3. 89₁₀

4. 112₁₀

5.2 Binary to Decimal Conversion

Convert the following binary numbers to decimal:

1. 1101₂

2. 10010₂

3. 111001₂

4. 101101₂

5.3 Additional Conversions

1. Convert 74₁₀ to binary.


Lab Manual: Number Systems
2. Convert 11011₂ to decimal.

3. Convert 111000₁₀ to binary.

Octal and Decimal

Introduction to Octal and Decimal Systems

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.

Method for Converting Octal to Decimal

To convert an octal number to decimal:

1. Write down the octal number.

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).

3. Sum the results of each multiplication to get the decimal equivalent.

(16)8 to decimal

position = {1-1, 6-0}

=1x81+6x80

=8+6

= (14)10

(7777)8 to decimal

position = {7-3, 7-2, 7-1, 7-0}

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.

Method for Converting Hexadecimal to Decimal

To convert a hexadecimal number to decimal:

1. Write down the hexadecimal number.

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).

3. Sum the results of each multiplication to get the decimal equivalent.

For example: Convert hexadecimal number (25)16 to its decimal form.


(25)16 = 2 × 161 + 5 × 160

= 2 × 16 + 5 × 1

= 32 + 5

= 37

Therefore, (25)16 = (37)10.

Home Assignment

Section A: Decimal to Binary Conversion


Lab Manual: Number Systems
Convert the following decimal numbers to binary:
3710
8210
12310
4510
9910
Section B: Decimal to Octal Conversion
Convert the following decimal numbers to octal:
5810
14910
25410
3710
9010
Section C: Decimal to Hexadecimal Conversion
Convert the following decimal numbers to hexadecimal:
25510
10210
7610
18510
21210
Section D: Binary to Decimal Conversion
Convert the following binary numbers to decimal (Base-10):

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!

You might also like