0% found this document useful (0 votes)
2 views30 pages

Number System

The document covers the representation of numbers in computing, focusing on fractional numbers, numeric and alphanumeric data, and various encoding systems like BCD, ASCII, and UNICODE. It explains fixed-point and floating-point representations, their advantages and disadvantages, and introduces binary arithmetic operations including addition, subtraction, multiplication, and division. Additionally, it discusses 1's and 2's complements for representing negative numbers and their significance in simplifying computer arithmetic.

Uploaded by

zayanahmed4857
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)
2 views30 pages

Number System

The document covers the representation of numbers in computing, focusing on fractional numbers, numeric and alphanumeric data, and various encoding systems like BCD, ASCII, and UNICODE. It explains fixed-point and floating-point representations, their advantages and disadvantages, and introduces binary arithmetic operations including addition, subtraction, multiplication, and division. Additionally, it discusses 1's and 2's complements for representing negative numbers and their significance in simplifying computer arithmetic.

Uploaded by

zayanahmed4857
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

Number System

Topics Covered:

● Fractional Numbers
● Numeric and Alphanumeric Data
● BCD, EBCDIC, ASCII, UNICODE
Introduction

● Computing relies on representing and processing data.


● Data can be numerical or alphanumeric.
● Understanding data representation is crucial for tasks like encoding,
arithmetic operations, and data storage.
Fractional Numbers

Definition:

● Numbers that have a decimal or fractional part.

Examples:

● Decimal: 3.14,−7.253
● Binary Fraction: 0.101​(2) (equivalent to 0.6251(10))
How They're Represented:

● Fixed-point: Fractional part fixed at specific digits.


● Floating-point: Scientific notation for numbers.
Fixed-Point Representation

What is it?

● In fixed-point representation, the fractional part is stored with a fixed number of digits (or
bits) after the decimal (or binary point).

How does it work?

● A predetermined position separates the integer and fractional parts.


● The system does not use an explicit decimal or binary point but assumes its position
based on the fixed format.
Fixed-Point Representation

Advantages:

● Simple to implement in hardware.


● Fast for arithmetic operations.

Disadvantages:

● Limited range and precision (depends on the fixed number of bits).


Floating-Point Representation

What is it?

● A flexible way to represent very large or very small fractional numbers, similar to
scientific notation in mathematics.

How does it work?

● A number is divided into three parts:


○ Sign: Determines if the number is positive or negative.
○ Mantissa (or significant): The main digits of the number.
○ Exponent: Determines where the decimal (or binary) point is placed
Floating point formula

Where M is the mantissa and E is the exponent.


Floating-Point Representation

Advantages:

● Wide range of values.


● High precision for scientific calculations.

Disadvantages:

● More complex hardware implementation.


● Precision issues in certain cases (rounding errors).
Numeric and Alphanumeric Data

Numeric Data:

● Includes integers and fractional numbers (e.g., 123,−56.78).

Alphanumeric Data:

● Combination of letters, numbers, and symbols.


● Examples: "Gene123", "2024!".

Why Important?
● Numeric data is used for calculations.
● Alphanumeric data is vital for names, IDs, and sequences.
Data Encoding

What is Encoding?

● Process of converting characters into machine-readable formats.

Purpose:

● Standardized data representation.


● Ensures interoperability between devices.
BCD (Binary Coded Decimal)

Definition:

● Each decimal digit is represented by a 4-bit binary code.


EBCDIC (Extended Binary Coded Decimal
Interchange Code)
Definition:
● 8-bit character encoding used mainly in IBM systems.
Key Features:
● Represents alphanumeric data and special characters.
● Not as widely used as ASCII today.
Example:
● 'A' in EBCDIC: 110000011100 000111000001.
ASCII (American Standard Code for Information
Interchange)
Definition:

● 7-bit encoding representing 128 characters.

Key Features:

● Widely used in computing systems.


● Includes letters, numbers, symbols, and control characters.

Example:

● 'A': 6510​ or 10000012


● 'a': 9710 or 11000012
UNICODE

Definition:
● A universal character encoding standard supporting all languages and scripts.
Key Features:
● 16-bit and 32-bit variants allow thousands of characters.
● Supports emojis, symbols, and non-English alphabets.
Examples:
● 'A' in Unicode: U+0041
● '😊': U+1F60A
Binary Arithmetic
Binary Addition

Rules:
● 0+0=0
● 0+1=1
● 1+0=1
● 1+1=10 (Carry 1 to the next higher bit)
Binary Addition

1011

+ 1101

--------
Binary Subtraction

Rules:
● 0−0=0
● 1−0=1
● 1−1=0
● 0−1=1 (Borrow 1 from the next higher bit)
Binary Subtraction

1101

- 1011

--------
Binary Multiplication

Rules:
● 0×0=0
● 0×1=0
● 1×0=0
● 1×1=1

Binary multiplication is similar to decimal long multiplication, but each digit is either 0 or 1
Binary Multiplication

101

× 11

--------

101 (101 × 1)

+ 1010 (101 × 1, shifted one position left)

--------

1111
Binary Division

Example: 10101÷101
Take the first 3 bits (101) of the dividend (10101)—this is equal to the divisor (101).

● Result: 1
● Subtract: 101−101=0

Bring down the next bit (0): Dividend becomes 0.

● Result: 0
Bring down the next bit (1): Dividend becomes 01.

Since 01<101 result: 0

Final Result 101012÷1012=1012 with remainder 0.


1’s and 2’s Complements in Binary Arithmetic

● Used to represent negative numbers in binary

● Fundamental to computer arithmetic operations

● Enables simple and efficient addition and subtraction


What is 1’s Complement?

● 1’s complement of a binary number is formed by inverting all bits (changing 0 → 1 and 1 → 0).

How it works:

For n-bit binary number, 1’s complement = 2n−1−𝑁 Used in early computers to represent negative
numbers

Decimal Binary (8-bit) 1’s Complement


+5 00000101 11111010 (represents -5)

In 1’s complement, two representations for 0 exist:


00000000 (+0) and 11111111 (–0).
What is 2’s Complement?

● 2’s complement is formed by inverting all bits (1’s complement) and then adding 1 to the result.

How it works:
● Take binary number
● Find 1’s complement
● Add 1 to LSB

Step Binary Explanation


Original 00000101 +5
1’s Complement 11111010 invert bits
Add 1 11111011 = -5 (2’s complement)
Why Complements Are Necessary

Purpose:
● Computers perform arithmetic using binary addition only.
● Subtraction can be done using complements instead of separate logic.
● Simplifies hardware design for ALUs (Arithmetic Logic Units).
Key Differences and Benefits

Comparison Table:

Feature 1’s Complement 2’s Complement


Negation Invert bits Invert bits + 1
Zero Representation Two (±0) One (0)
Arithmetic Simplicity Needs end-around carry Simple binary addition
Hardware Use Today Rare Standard in all modern systems
Computer Benefits

● Simplifies circuit design


● Enables fast arithmetic
● Supports signed integer representation

You might also like