Docsity

base of machine structure, Study notes of Political Science

Toggle sidebar
bg1
Computer Science Notes: Information
Representation
Chapter 1: General Introduction
Introduction to information representation and base numbering systems.
Chapter 2: Numbering Systems
1. Introduction
Every numbering system is based on a base (b) where:
Base 10 (Decimal): Uses 0-9 digits.
Base 2 (Binary): Uses 0-1 digits.
Each number in base (b) is made by combining digits from the set of symbols allowed in that
base.
Note: Always specify the base to avoid confusion (101)2 ≠ (101)10, except for base 10 which
is the useful base for humans.
2. Representation of a Positive Integer in Base (B)
Principle of Euclidean Division: X = q.B + r
Divide the number by the base repeatedly.
Record the remainders (until q < B).
Write remainders from last to first.
Example: (19)10 → (10011)2
Base 16 Digits (Hexadecimal)
{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F}
•
•
•
•
•
pf3
pf4
pf5

Partial preview of the text

Download base of machine structure and more Study notes Political Science in PDF only on Docsity!

Computer Science Notes: Information

Representation

Chapter 1: General Introduction

Introduction to information representation and base numbering systems.

Chapter 2: Numbering Systems

1. Introduction

Every numbering system is based on a base (b) where:

Base 10 (Decimal): Uses 0-9 digits.

Base 2 (Binary): Uses 0-1 digits.

Each number in base (b) is made by combining digits from the set of symbols allowed in that

base.

Note: Always specify the base to avoid confusion (101) 2

, except for base 10 which

is the useful base for humans.

2. Representation of a Positive Integer in Base (B)

Principle of Euclidean Division: X = q.B + r

Divide the number by the base repeatedly.

Record the remainders (until q < B).

Write remainders from last to first.

Example: (19) 10

Base 16 Digits (Hexadecimal)

{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F}

Basic Operations in Binary System

Binary Addition

Follows 4 simple rules:

Operation Carry Result

Ex: 1011 + 1101 = 11000

(When 1 + 1, we write 0 and carry 1 to the next column, just like 9 +

1 in decimal).

Binary Subtraction

Also has 4 rules:

Operation Carry (Borrow) Result

Ex: 1001 - 1101 = 0100 (borrowing 1 turns the 1 to 0 and adds 2 in

binary to the current column).

Chapter 03: Information Representation

This chapter explains how diverse information (numbers, text, images, sound) is represented

in a computer using binary code (0s and 1s).

1. Binary Coding

Computers use bits (binary digits) to represent information. n bits can represent 2

n unique

pieces of information.

Explanation:

1 bit → 2 informations (

2 bits → 4 informations (

3 bits → 8 informations (

1.2 Gray Code

The procedure:

G

n

= B

n

G

i

= B

i+

⊕ B

i

(for i = n-1 to 0)

⊕ is called XOR: a ⊕ b = 1 if a ≠ b (different), else 0.

Example: (1011) 2

to Gray Code

n=4 digits (B 3

B

B

B

G

= B

G

= B

⊕ B

G

= B

⊕ B

G

= B

⊕ B

Result: Gray Code = 1110

2.3 BCD (Binary-Coded Decimal) Code

In Base 10, digits 0-9 are replaced by the BCD code (4-bit binary equivalent).

Example: X = 687

BCD code: 0110 1000 0111

2.4 Excess-3 (XS-3) Code

Used in digital systems. Represents each decimal digit by adding 3 (0011) 2

to its BCD code.

Principle: Xs-3 = BCD code + (0011)

Example: X = 9

BCD(9) = 1001

XS-3 = (1001) + (0011) = 1100

4. Number Representation

4.1 Integers

4.3.1 Representation of Negative Integers in SAV (Sign and Absolute Value)

The Most Significant Bit (MSB) is the sign:

0 indicates a positive number

1 indicates a negative number

Range for n bits: -(

n-

    1. ≤ X ≤ 2

n-

  • 1

4.3.2 Representation of Negative Integers in 1's Complement (CP1)

Principle: A negative number is the bitwise logical NOT of its positive counterpart.

SAV is positive: Range same as SAV.

SAV is negative: Change 0 by 1 and vice versa (flip bits), keeping the sign bit.

Example: +30 = (11110) 2

in 5 bits + sign bit

SAV (+30) = 0 | 11110

CP1 (+30) = 0 | 11110

SAV (-30) = 1 | 11110

CP1 (-30) = 1 | 00001 (flip number bits, keep sign)