0% found this document useful (0 votes)
8 views15 pages

Understanding Positional Number Systems

The document provides an overview of the Positional Number System, detailing its structure, key concepts such as base and digit place value, and methods for converting between different number systems including binary, decimal, octal, and hexadecimal. It also covers complements used in digital systems for arithmetic operations and introduces various types of binary codes, including weighted and non-weighted codes. The content is essential for understanding digital logic circuits and computing fundamentals.

Uploaded by

Sampath Sai
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)
8 views15 pages

Understanding Positional Number Systems

The document provides an overview of the Positional Number System, detailing its structure, key concepts such as base and digit place value, and methods for converting between different number systems including binary, decimal, octal, and hexadecimal. It also covers complements used in digital systems for arithmetic operations and introduces various types of binary codes, including weighted and non-weighted codes. The content is essential for understanding digital logic circuits and computing fundamentals.

Uploaded by

Sampath Sai
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

Module-I: Number Sytem

Dr. M Rambabu
Course Code: 24CSEN1001
Course Name: Digital Logic Circuits
December 24, 2025

1 Introduction to Positional Number System


A Positional Number System is a method of representing numbers where the value of each digit
depends on its position in the number. Unlike non-positional systems (such as Roman numerals),
the positional system allows efficient representation and calculation of numbers.

2 Key Concepts
2.1 Base or Radix
Every positional number system is defined by a base (or radix), denoted as B. The base determines
the total number of unique digits available. The most commonly used number systems are:

ˆ Binary (Base-2): Uses digits {0, 1}

ˆ Octal (Base-8): Uses digits {0, 1, 2, 3, 4, 5, 6, 7}

ˆ Decimal (Base-10): Uses digits {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}

ˆ Hexadecimal (Base-16): Uses digits {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F}

2.2 Digit Place Value


Each digit in a number has a place value based on its position. The value of a digit in a positional
number system is given by:

Digit Value = (Digit) × (Base)Position (1)

For a number represented as:


(dn dn−1 . . . d1 d0 .d−1 d−2 . . . )B (2)
The decimal equivalent is computed as:
n
X
di × B i (3)
i=−m

where di is the digit at position i, and B is the base.

1
3 Examples
3.1 Binary to Decimal Conversion
Convert 110012 to decimal:

110012 = (1 × 24 ) + (1 × 23 ) + (0 × 22 ) + (0 × 21 ) + (1 × 20 )
= (1 × 16) + (1 × 8) + (0 × 4) + (0 × 2) + (1 × 1)
= 16 + 8 + 0 + 0 + 1
= 2510

3.2 Decimal to Binary Conversion


Convert 2510 to binary using successive division by 2:

25 ÷ 2 = 12, remainder 1
12 ÷ 2 = 6, remainder 0
6 ÷ 2 = 3, remainder 0
3 ÷ 2 = 1, remainder 1
1 ÷ 2 = 0, remainder 1

Reading the remainders from bottom to top, we get:

2510 = 110012 (4)

3.3 Octal to Decimal Conversion


Convert 1478 to decimal:

1478 = (1 × 82 ) + (4 × 81 ) + (7 × 80 )
= (1 × 64) + (4 × 8) + (7 × 1)
= 64 + 32 + 7
= 10310

3.4 Decimal to Octal Conversion


Convert 10310 to octal using successive division by 8:

103 ÷ 8 = 12, remainder 7


12 ÷ 8 = 1, remainder 4
1 ÷ 8 = 0, remainder 1

Reading the remainders from bottom to top, we get:

10310 = 1478 (5)

2
Conclusion
The Positional Number System is the foundation of modern numerical representation and com-
puting. It allows efficient arithmetic operations and conversion between different bases, making it
essential in digital electronics and computer science.

4 General Radix r System


A number system with base or radix r consists of r unique symbols (digits), which are used to
represent numbers. The value of a number in a radix-r system depends on its position in the
number.

4.1 Representation of a Number in Radix r


A number in a radix r system can be represented as:

(N )r = dn dn−1 . . . d1 d0 .d−1 d−2 . . . d−m


where:

ˆ r is the base (or radix) of the number system.

ˆ di are the digits, where each di satisfies 0 ≤ di < r.

ˆ The digits before the decimal point (dn to d0 ) represent the integer part.

ˆ The digits after the decimal point (d−1 to d−m ) represent the fractional part.

The decimal equivalent of a number in radix r is given by:


n
X
(N )10 = di · r i
i=−m

4.2 Example: Binary (r = 2) Representation


Consider the binary number (1011.101)2 :

(1011.101)2 = 1 × 23 + 0 × 22 + 1 × 21 + 1 × 20 + 1 × 2−1 + 0 × 2−2 + 1 × 2−3

= 8 + 0 + 2 + 1 + 0.5 + 0 + 0.125

= (11.625)10

5 Number System Conversions


Conversions between different number systems are essential in computing and digital logic. Below
are standard methods to convert numbers between decimal, binary, octal, and hexadecimal.

3
5.1 Decimal to Other Bases
To convert a decimal integer to a base r, use the **repeated division method**:
1. Divide the number by r and record the remainder. 2. Continue dividing the quotient by r
until the quotient becomes zero. 3. The base-r representation is obtained by reading the remainders
from bottom to top.

5.1.1 Example: Convert (43)10 to Binary (r = 2)


Quotient Remainder
43 ÷ 2 = 21 1
21 ÷ 2 = 10 1
10 ÷ 2 = 5 0
5÷2=2 1
2÷2=1 0
1÷2=0 1
Reading remainders from bottom to top: (43)10 = (101011)2 .

5.2 Binary to Decimal Conversion


To convert a binary number to decimal, use the expansion formula:
X
(N )2 = di · 2 i

5.2.1 Example: Convert (1101.101)2 to Decimal


(1101.101)2 = 1 × 23 + 1 × 22 + 0 × 21 + 1 × 20 + 1 × 2−1 + 0 × 2−2 + 1 × 2−3

= 8 + 4 + 0 + 1 + 0.5 + 0 + 0.125

= (13.625)10

5.3 Binary to Octal and Hexadecimal Conversion


Since **octal (r = 8)** and **hexadecimal (r = 16)** are powers of 2, conversion from binary is
straightforward:
- **Binary to Octal**: Group bits in sets of 3 from right to left. - **Binary to Hexadecimal**:
Group bits in sets of 4 from right to left.

5.3.1 Example: Convert (1101101)2 to Octal (r = 8)


11011012 = 001 101 1012

= (1 5 5)8

(1101101)2 = (155)8

4
6 Complements
Complements are used in digital systems for simplifying arithmetic operations. There are two types
of complements:

6.1 1’s Complement


The **1’s complement** of a binary number is obtained by flipping all bits (changing 0s to 1s and
vice versa).

6.1.1 Example: 1’s Complement of (1011001)2


(1011001)2 → (0100110)2

6.2 2’s Complement


The **2’s complement** of a binary number is obtained by: 1. Taking the **1’s complement**. 2.
Adding 1 to the least significant bit (LSB).

6.2.1 Example: 2’s Complement of (1011001)2


1′ s complement: (0100110)2

+1

= (0100111)2

6.3 Radix and Diminished Radix Complements


For a number N in base r with n digits:
1. **Radix Complement (r’s complement)**: rn − N
2. **Diminished Radix Complement ((r-1)’s complement)**: (rn − 1) − N

6.3.1 Example: 10’s and 9’s Complement of (3250)10


9’s Complement:

(9999 − 3250) = (6749)10


10’s Complement:

(9999 − 3250) + 1 = (6750)10

6.4 Use of Complements in Subtraction


To subtract B from A using complements: 1. Compute the complement of B. 2. Add it to A. 3. If
there is an overflow, discard it.

5
6.4.1 Example: Subtract (27)10 from (49)10 using 10’s Complement
10′ s complement of 27 = (100 − 27) = 73

49 + 73 = 122

Drop carry (1), result: 2210

6.5 Taking 1’s and 2’s Complements for Binary Numbers


6.6 1’s Complement
The 1’s complement of a binary number is obtained by flipping all the bits (changing 0s to 1s and
1s to 0s).

Example: Find the 1’s Complement of (1011001)2


(1011001)2 → (0100110)2

6.7 2’s Complement


The 2’s complement of a binary number is obtained by:

1. Taking the 1’s complement.

2. Adding 1 to the least significant bit (LSB).

Example: Find the 2’s Complement of (1011001)2


Step 1: 1’s Complement (1011001)2 → (0100110)2

Step 2: Add 1

(0100110)2 + (0000001)2 = (0100111)2

6.8 Binary Subtraction Using Complements


Binary subtraction can be performed using complements to avoid the need for direct subtraction.

6.8.1 Subtraction Using 1’s Complement


To subtract B from A using 1’s complement:

1. Find the 1’s complement of B.

2. Add it to A.

3. If there is a carry, add it to the sum (End-around carry).

6
Example: (1010)2 − (0100)2 Using 1’s Complement
A = (1010)2 , B = (0100)2

Step 1: Find 1’s complement of B

(0100)2 → (1011)2

Step 2: Add A + (1′ s Complement of B)

(1010)2 + (1011)2 = (10101)2

Step 3: End-around carry (if carry exists, add it to LSB)

(0101)2 + 1 = (0110)2

Final result: (0110)2 = (6)10

6.9 Subtraction Using 2’s Complement


To subtract B from A using 2’s complement:

1. Find the 2’s complement of B.

2. Add it to A.

3. If a carry is generated, discard it; otherwise, take the 2’s complement of the result (indicating
a negative value).

Example: (1010)2 − (0100)2 Using 2’s Complement


A = (1010)2 , B = (0100)2

Step 1: Find 2’s complement of B

1’s complement: (0100)2 → (1011)2

Add 1: (1011)2 + (0001)2 = (1100)2

Step 2: Add A + (2′ s Complement of B)

(1010)2 + (1100)2 = (10110)2

Discard carry bit (leftmost 1)

Final result: (0110)2 = (6)10

7
Example: (0100)2 − (1010)2 Using 2’s Complement (Negative Result)
A = (0100)2 , B = (1010)2

Step 1: Find 2’s complement of B

1’s complement: (1010)2 → (0101)2

Add 1: (0101)2 + (0001)2 = (0110)2

Step 2: Add A + (2′ s Complement of B)

(0100)2 + (0110)2 = (1010)2


Since no carry bit is generated, the result is negative. To get the magnitude:

Find 2’s complement of (1010)2

1’s complement: (1010)2 → (0101)2

Add 1: (0101)2 + (0001)2 = (0110)2

Final result: (−6)10

Conclusion
The **radix-r system** is fundamental in computing, and conversions between different bases are
crucial for digital logic design. Complement systems, such as **1’s and 2’s complement**, simplify
arithmetic operations, especially subtraction.

7 Binary Codes
Binary codes are used to represent data in digital systems using a combination of bits (0s and 1s).
These codes are classified into different categories based on their properties and applications.

7.1 Taxonomy of Binary Codes


Binary codes can be broadly categorized as follows:

ˆ Weighted Codes

– Binary-Coded Decimal (BCD)


– Excess-3 (XS-3)

ˆ Non-Weighted Codes

– Gray Code

8
– ASCII Code

ˆ Error-Detecting and Correcting Codes

– Parity Codes (Even and Odd Parity)


– Hamming Code

8 Types of Binary Codes


8.1 Weighted Codes
Weighted codes assign a specific weight to each digit position.

8.1.1 Binary-Coded Decimal (BCD)


BCD is a weighted code where each decimal digit (0 to 9) is represented by a 4-bit binary equivalent.

Decimal Digit BCD Representation


0 0000
1 0001
2 0010
3 0011
4 0100
5 0101
6 0110
7 0111
8 1000
9 1001

Example: Convert (79)10 to BCD:

7 = (0111)2 , 9 = (1001)2

BCD Representation: (01111001)BCD

8.1.2 Excess-3 (XS-3) Code


Excess-3 is a modified BCD code where each decimal digit is represented by adding 3 to its BCD
equivalent.

Decimal Digit Excess-3 Representation


0 0011
1 0100
2 0101
3 0110
4 0111
5 1000
6 1001
7 1010
8 1011
9 1100

9
Example: Convert (79)10 to Excess-3:

7 + 3 = (1010)2 , 9 + 3 = (1100)2

Excess-3 Representation: (10101100)XS-3

8.2 Non-Weighted Codes


8.2.1 Gray Code
Gray code is a binary code where only one bit changes between consecutive numbers. It is used in
error correction and minimizing digital hardware transitions.

Decimal Digit Gray Code


0 0000
1 0001
2 0011
3 0010
4 0110
5 0111
6 0101
7 0100
8 1100
9 1101

Example: Convert (1010)2 to Gray code:

ˆ The first bit remains the same: 1

ˆ XOR each consecutive bit:

1 ⊕ 0 = 1, 0 ⊕ 1 = 1, 1⊕0=1

Gray Code: (1111)2

8.2.2 ASCII Code


ASCII (American Standard Code for Information Interchange) is a character encoding standard for
text.

Character ASCII (Binary)


A 01000001
B 01000010
C 01000011
0 00110000
1 00110001
2 00110010

Example: ASCII representation of ”AB”:

A = (01000001)2 , B = (01000010)2

10
Conclusion
Binary codes are essential for data representation, error detection, and digital communication. Un-
derstanding different coding techniques helps in designing efficient digital systems.

9 Arithmetic with Signed and Unsigned Numbers


In digital systems, numbers are represented in binary, and arithmetic operations like addition and
subtraction follow specific rules based on the number representation. This section discusses different
number representations and their impact on arithmetic operations.

9.1 Data Representation


Binary numbers can be represented in several ways, particularly for signed values. The most com-
monly used methods are:

9.1.1 Unsigned Binary Representation


In unsigned representation, all bits represent magnitude, and there is no sign bit. The range for an
n-bit unsigned number is:

0 to (2n − 1)
Example: For an 8-bit number, the range is:

0 to 255 (000000002 to 111111112 )

9.1.2 Sign-Magnitude Representation


In sign-magnitude representation, the most significant bit (MSB) indicates the sign (0 for positive,
1 for negative), and the remaining bits represent the magnitude.

Decimal Sign-Magnitude (8-bit)


+5 00000101
-5 10000101
Issues:
ˆ Two representations for zero: 000000002 and 100000002 .

ˆ Arithmetic operations are complex.

9.1.3 One’s Complement Representation


In one’s complement, negative numbers are obtained by inverting all bits of their positive counterpart.
Decimal One’s Complement (8-bit)
+5 00000101
-5 11111010
Issues:
ˆ Two representations for zero: 000000002 and 111111112 .

ˆ Requires end-around carry correction in addition.

11
9.1.4 Two’s Complement Representation
In two’s complement, negative numbers are obtained by inverting the bits and adding 1.

Decimal Two’s Complement (8-bit)


+5 00000101
-5 11111011

Advantages:

ˆ Single representation for zero.

ˆ Simple addition and subtraction rules.

9.2 Arithmetic Operations


9.2.1 Addition of Signed Numbers
Addition in two’s complement follows standard binary addition rules. Overflow occurs if the result
exceeds the representable range.
Example: Add +5 and −3 in 8-bit two’s complement.

+5 = 000001012 , −3 = 111111012

Sum: 00000101 + 11111101 = 000000102 = +2


Example: Add +7 and +6 in 4-bit two’s complement.

01112 + 01102 = 11012


Since 11012 is a negative number, overflow has occurred.

9.2.2 Subtraction using Two’s Complement


Subtraction is performed by adding the two’s complement of the subtrahend.
Example: Compute 5 − 3 in 8-bit two’s complement.

5 = 000001012 , −3 = Two’s complement of 000000112 = 111111012

Sum: 00000101 + 11111101 = 000000102 = +2

9.3 Overflow Detection


Overflow occurs when the result of an arithmetic operation exceeds the range of the given bit repre-
sentation.

12
9.3.1 Overflow Conditions in Two’s Complement
ˆ Overflow occurs when adding two positive numbers results in a negative number.

ˆ Overflow occurs when adding two negative numbers results in a positive number.

ˆ No overflow occurs when adding a positive and a negative number.

Example: Check overflow for +60 + 70 in 8-bit two’s complement.

60 = 001111002 , 70 = 010001102

Sum: 00111100 + 01000110 = 100000102


Since the MSB (sign bit) changed, overflow occurred.

9.3.2 Overflow in Unsigned Arithmetic


In unsigned arithmetic, overflow occurs if the carry-out from the MSB is 1.
Example: Check overflow for 200 + 100 in 8-bit unsigned binary.

200 = 110010002 , 100 = 011001002

Sum: 11001000 + 01100100 = 001011002 (carry generated)


Since carry-out occurred, overflow happened.

10 BCD (Binary-Coded Decimal) Arithmetic


Binary-Coded Decimal (BCD) is a number representation where each decimal digit is represented
separately in a 4-bit binary form. BCD is widely used in digital systems where decimal precision is
required, such as calculators and financial applications.

10.1 BCD Representation


Each decimal digit (0–9) is represented by its 4-bit binary equivalent.

Decimal BCD (4-bit)


0 0000
1 0001
2 0010
3 0011
4 0100
5 0101
6 0110
7 0111
8 1000
9 1001

10.2 BCD Addition


BCD addition follows standard binary addition rules with an extra correction step to ensure the
result remains in valid BCD form.

13
10.2.1 BCD Addition Rules
1. Perform binary addition on the BCD digits.

2. If the sum is greater than 9 (1001 in binary), or if there is a carry from the lower BCD digit,
add **6 (0110)** to correct it.

3. If a carry is generated after correction, propagate it to the next higher BCD digit.

Example 1: Add 5 (0101) and 7 (0111) in BCD

01012 + 01112 = 11002


Since **1100 (12 in decimal) is invalid in BCD**, we add 6 (0110) to correct it:

11002 + 01102 = 000102


The final result is **0010 0000 (20 in decimal)**.

10.2.2 Example 2: Add 29 and 35 in BCD


Step 1: Convert to BCD:
29 = 0010 1001, 35 = 0011 0101
Step 2: Perform binary addition:

0010 1001
+ 0011 0101
0101 1110 (not valid BCD, second digit exceeds 9)

Step 3: Apply correction (add 6 to second digit):

1110 + 0110 = 0000 (carry generated)


Final result after carry propagation:

0111 0000 = 7010

10.3 BCD Subtraction


BCD subtraction is performed using the **9’s complement method** followed by addition.

10.3.1 Steps for BCD Subtraction


1. Find the **9’s complement** of the subtrahend.

2. Add the 9’s complement to the minuend.

3. If there is a carry, discard it and the result is positive.

4. If no carry occurs, take the **9’s complement** of the result to get the correct negative value.

14
Example: Compute 23 - 15 in BCD
Step 1: Convert to BCD:

23 = 0010 0011, 15 = 0001 0101


Step 2: Compute 9’s complement of 15:

(9 − 1) = 8, (9 − 5) = 4 ⇒ 15′ = 1000 0100


Step 3: Add the 9’s complement:

0010 0011 + 1000 0100 = 1010 0111


Step 4: Discard carry and apply correction:

0011 1000 = 0810 (correct answer)

15

You might also like