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.