0% found this document useful (0 votes)
4 views62 pages

Understanding Number Systems in Computing

The document provides an introduction to number systems used in computing, including decimal, binary, hexadecimal, and octal systems. It covers number system conversions, arithmetic operations, and the representation of signed and unsigned numbers. Additionally, it explains the concepts of complements in binary numbers, specifically one's and two's complement methods.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views62 pages

Understanding Number Systems in Computing

The document provides an introduction to number systems used in computing, including decimal, binary, hexadecimal, and octal systems. It covers number system conversions, arithmetic operations, and the representation of signed and unsigned numbers. Additionally, it explains the concepts of complements in binary numbers, specifically one's and two's complement methods.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Introduction & Programming with

Number Systems
ESP8266

P. Rajakumar
Assistant Professor
Department of CSE
Parul Institute of Technology
Content

1. Introduction to Number System…..……………. 1


2. Number System Conversion.………………………. 2
3. Arithmetic operation in Number System……. 3
4. Signed and Unsigned Numbers…………………… 4
5. Complements of binary numbers…………………5

INDEX
Introduction to Number System

A computer is a digital system that stores and processes different


types of data in the form of 0s and 1s. The different types of data
include numbers, alphabets and some special characters.

All the number systems used by computer professionals to interact


with computer systems come under the category of positional
number system.

The positional number system is a number system in which numbers


are represented using some symbols called digits.
The different number systems are,
• Decimal Number system
• Binary Number system
• Hexadecimal Number system
• Octal Number system
Decimal Number system
➢ The decimal system is the most common number system used by
human beings.
➢ It is a positional number system that uses 10 as a base to represent
different values.
➢ Therefore, this number system is also known as base10 number
system. In this system, 10 symbols are available for representing the
values.
➢ These symbols include the digits from 0 to 9.
➢ The common operations performed in the decimal system are
addition (+), subtraction (–), multiplication (×) and division (/).
➢ It can be used to represent both the integer as well as floating point
values.
6543.124
The value 6543, which comes before the decimal point, is called
integer value and the value 124, which comes after the decimal point,
is called fraction value.
➢ lists the weights associated with each digit in the given decimal
number.
Using the place values, the floating point number 6543.124 in decimal
system can be computed as:

Binary Number System


➢ Binary number system is used in all the modern digital computer
systems.
➢ The binary system uses base 2 to represent different values.
➢ Therefore, the binary system is also known as base-2 system.
➢ These symbols are 0 and 1.
The following are some of the technical terms used in binary
system:
Bit- It is the smallest unit of information used in a computer system,
either the value 0 or 1.
Nibble- It is a combination of 4 bits.
Byte- It is a combination of 8 bits.
Word- It is a combination of 16 bits
Double word- It is a combination of 32 bits.
Kilobyte (KB)- It is used to represent the 1024 bytes of information.
Megabyte (MB)- It is used to represent the 1024 KBs of information.
Gigabyte (GB)- It is used to represent the 1024 MBs of information.
Example
101001.0101
weight associated with each bit in the given binary number is
The value of the binary number 101001.0101 can be obtained as:

Hexadecimal Number System


➢ The hexadecimal system uses base 16 to represent different values.
➢ It is known as base-16 number system.
➢ 16 symbols are available for representing the values in this system.
➢ These symbols are the digits 0–9 and the letters A, B, C, D, E and
F.
The weight associated with each symbol in the given hexadecimal
number,
Example
4A9.2B
The weights associated with each digit in the given hexadecimal
number.

Therefore, the value of the given hexadecimal number is:


Octal Number System.
➢ The octal system uses base 8 to represent different values.
➢ It is also known as base-8 system
➢ The symbols are the digits 0 to 7.
Example
215.43
weights associated with each digit in the given octal number.
Weighted Binary Coded Decimal (BCD) Systems
The weighted 4-bit BCD code is more commonly known as 8421
weighted code.
Conversion of Numbers(Number system Conversion)
Number system conversions can be divided into the following major
categories:
• Non-decimal to decimal
• Decimal to non-decimal
• Octal to hexadecimal

Non-decimal to decimal
• Binary to decimal conversion
• Hexadecimal to decimal conversion
• Octal to decimal conversion
Binary to decimal conversion
A binary number can be converted to equivalent decimal number by
calculating the sum of the products of each bit multiplied by its
corresponding place value.
Hexadecimal to decimal conversion
A hexadecimal number can be converted into its equivalent number in
decimal system by calculating the sum of the products of each symbol
multiplied by its corresponding place value.
Octal to Decimal System
An octal number can be converted into its equivalent number in decimal
system by calculating the sum of the products of each digit multiplied by
its corresponding place value.
Decimal to Non-Decimal
The decimal to non-decimal conversions are carried out by continually
dividing the decimal number by the base of the desired number system
till the decimal number becomes zero.
• Decimal to binary conversion
• Decimal to hexadecimal conversion
• Decimal to octal conversion

Decimal to binary conversion


The decimal to binary conversion is performed by repeatedly dividing
the decimal number by 2 till the decimal number becomes zero.
Octal to Hexadecimal
The given octal number can be converted into its equivalent
hexadecimal number in two different steps.
➢ Firstly, convert the given octal number into its binary equivalent.
➢ Divide the binary number into 4-bit sections starting from the LSB.
Octal to Hexadecimal
The given octal number can be converted into its equivalent
hexadecimal number in two different steps.
➢ Firstly, convert the given octal number to 3-bit binary equivalent.
➢ Group the binary number into 4-bit sections starting from the LSB.
.
Number System Conversion(extra).

➢ Hexadecimal to Binary- Convert each hexadecimal digit into 4-bit


binary code.

➢ Hexadecimal to Octal- Convert each hexadecimal digit into 4-bit


binary code, then group into 3-bit from LSB.

➢ Octal to Binary- Convert each octal digit into 3-bit binary code.

➢ Octal to Hexadecimal- Convert each octal digit into 3-bit binary


code, then group into 4-bit from LSB.
Arithmetic Operation in Number System
• A computer system stores and processes billions of instructions in
a second that involves a lot of arithmetic computations.
• The different arithmetic operations in the computer system are
performed by the Arithmetic and Logic Unit (ALU).
• The computer arithmetic is also referred as binary arithmetic
because the computer system stores and processes the data in the
binary form only.
The different binary arithmetic operations performed in a computer
system are:
➢ Binary addition
➢ Binary multiplication
➢ Binary subtraction
➢ Binary division
Binary Addition.
Binary addition is the simplest arithmetic operation performed in the
computer system. The table shows the lists the rules for binary
addition.
Example
Example
Rules for adding three binary numbers
Binary Subtraction.
The binary subtraction is performed in the same way as the decimal
subtraction. The table shows the lists the rules for binary addition.

Binary Subtraction Rules


Binary Subtraction.
The binary subtraction is performed in the same way as the decimal
subtraction. The table shows the lists the rules for binary addition.

Binary Subtraction Rules


Example
Example
Example
Binary Multiplication
➢ The multiplication of two binary numbers can be carried out in the
same manner as the decimal multiplication.
➢ The binary multiplication can also be considered as repeated binary
addition.
Binary Multiplication Rules
Binary Multiplication
Binary Multiplication
Binary Division
• Binary division is also performed in the same way as we perform
decimal division.
• The dividend should be greater than the divisor.
• Two important points, need to be remembered while performing the
binary division

➢ If the remainder obtained by the division process is greater than or


equal to the divisor, put 1 in the quotient and perform the binary
subtraction.

➢ If the remainder obtained by the division process is less than the


divisor, put 0 in the quotient and append the next most significant
digit from the dividend to the remainder.
Binary Division
Binary Division
Binary Division

Perform binary division of 11011 and 1001


1 1 0 0
1 1 0 0
-------------
0 0 0 1
0 0 0 0
-------------
0 0 0 1
Signed and Unsigned Numbers

Unsigned Numbers
➢ Unsigned numbers represent zero and positive values only.
➢ It has only magnitude bits, there is no sign bits.
➢ An n-bit unsigned number ranges from 0 to 2n-1.
➢ For an 8-bit unsigned integer can represent values from 0 to 255.

Signed Numbers
➢ Signed numbers has two parts magnitude and sign bits.
➢ The signed binary number always associated with sign.
➢ This sign represents the given number is positive or negative.
➢ Sign bit is 0 for positive and 1 for negative numbers.
➢ An n-bit unsigned number ranges from -2n-1 to 2n-1.
➢ For an 8-bit unsigned integer can represent values from -255 to 255.
8-bit signed magnitude representation

Consider an example of 8-bit signed magnitude representation of 50.


Consider an example of 8-bit signed magnitude representation of -50.
Complements of binary numbers.
• The complement system can also be used to represent the signed
binary numbers apart from the signed magnitude representation
method.
• In the complement system, the positive integers are represented in
a similar manner as they are represented in the signed-magnitude
representation.
There are two complement methods.
➢ One’s complement.
➢ Two’s complement.
One’s complement.
➢ One’s complement method can be used to represent negative
numbers.
➢ First convert binary equivalent to that number and then change all 0
to 1 and 1 to 0.
➢ Therefore, –15 can be represented using one’s complement method as
11110000.
➢ The one’s complement method also uses the left most bit as the sign
bit to indicate the sign of the number.
Two’s complement.
➢ Two’s complement is widely used method for representing negative
numbers in the computer system.
➢ The two’s complement can be obtained by adding 1 to the one’s
complement of that number.
➢ Binary subtraction is easier because it is replaced with addition of
complements.

You might also like