Number Systems PDF
Document Details
Uploaded by SimplifiedCthulhu
MMSU
Tags
Related
- Class 7 Computer Chapter 1 Answers PDF
- Introduction To Computer Number Systems PDF
- Sri Lanka Institute of Information Technology Mathematics for Computing - PDF
- Week 2: Number System and Binary Operations PDF
- Data Representation Inside Computer PDF
- Revision Notes on Computer Number Systems and Representation (PDF)
Summary
This document provides an introduction to fundamental computer number systems, including binary, decimal, octal, and hexadecimal. It explains the bases and representation of these systems, along with conversion methods and arithmetic operations. The document is suitable for undergraduate-level computer science students.
Full Transcript
# Lesson 1: Introduction to Computer Number Systems - **Objective:** Explain computer number systems, including binary, decimal, octal, and hexadecimal. ## Introduction to the binary number system. Computer number systems are methods of representing and working with numbers in the context of digi...
# Lesson 1: Introduction to Computer Number Systems - **Objective:** Explain computer number systems, including binary, decimal, octal, and hexadecimal. ## Introduction to the binary number system. Computer number systems are methods of representing and working with numbers in the context of digital computing. These systems are essential for encoding data, performing calculations, and communicating information within computers and across digital devices. The four primary computer number systems are binary, decimal, octal, and hexadecimal. ## 1. Binary Number System (Base-2): - Binary is the fundamental number system in computing. It uses only two digits: 0 and 1. - Each digit in binary represents a power of 2, with the rightmost digit representing $2^0$ (1), the next digit to the left representing $2^1$ (2), the next $2^2$ (4), and so on. - Binary numbers are used in all digital devices and computer systems to represent data and perform logical operations, such as addition, subtraction, and bitwise operations. - Example: Binary number 1010 represents $1 \times 2^3 + 0 \times 2^2 + 1 \times 2^1 + 0 \times 2^0 = 8 + 0 + 2 + 0 = 10$ (in decimal). ## 2. Decimal Number System (Base-10): - Decimal is the number system most commonly used by humans. It employs ten digits: 0 to 9. - Each digit in decimal represents a power of 10, with the rightmost digit representing $10^0$ (1), the next digit to the left representing $10^1$ (10), the next $10^2$ (100), and so on. - Decimal numbers are used for everyday calculations, mathematics, and most human-oriented contexts. - Example: Decimal number 345 represents $3\times 10^2 + 4 \times 10^1 + 5 \times 10^0 = 300 + 40 + 5 = 345$. ## 3. Octal Number System (Base-8): - Octal uses eight digits: 0 to 7. - Each digit in octal represents a power of 8, with the rightmost digit representing $8^0$ (1), the next digit to the left representing $8^1$ (8), the next $8^2$ (64), and so on. - Octal numbers are less common in modern computing but were historically used to represent machine code and memory addresses. - Example: Octal number 52 represents $5 \times 8^1 + 2 \times 8^0 = 40 + 2 = 42$ (in decimal). ## Hexadecimal Number System (Base-16): - Hexadecimal employs sixteen digits: 0 to 9 and A to F (where A = 10, B = 11, C = 12, D = 13, E = 14, and F = 15). - Each digit in hexadecimal represents a power of 16, with the rightmost digit representing $16^0$ (1), the next digit to the left representing $16^1$ (16), the next $16^2$ (256), and so on. - Hexadecimal numbers are widely used in computing for representing binary data compactly and memory addresses. - Example: Hexadecimal number 1A7 represents $1 \times 16^2 + 10 \times 16^1 + 7 \times 16^0 = 256 + 160 + 7 = 423$ (in decimal). ## How about converting Decimals to computer number System? ### CONVERSION FROM DECIMAL TO BINARY | | | | |---|---|---| | $348_{10}$ | -> | $101011100_2$ | | $348 \div 2$ | = | $ 174$ r $0$ | | $174 \div 2$ | = | $ 87$ r $0$ | | $87 \div 2$ | = | $ 43$ r $1$ | | $43 \div 2$ | = | $ 21$ r $1$ | | $21 \div 2$ | = | $10$ r $1$ | | $10 \div 2$ | = | $5$ r $0$ | | $5 \div 2$ | = | $2$ r $1$ | | $2 \div 2$ | = | $1$ r $0$ | | $1 \div 2$ | = | $0$ r $1$ | * **LEAST SIGNIFICANT BIT** * **MOST SIGNIFICANT BIT** ### CONVERSION FROM DECIMAL TO OCTAL | | | | |---|---|---| | $348_{10}$ | | | | $348 \div 8$ | = | $ 43.5$ | | $43 \div 8$ | = | $ 5.375$ | | $5 \div 8$ | = | $ 0.625$ | * **LEAST SIGNIFICANT DIGIT** * **MOST SIGNIFICANT DIGIT** $348_{10} -> 534_8$ ### CONVERSION FROM DECIMAL TO HEXADECIMAL | | | | | |---|---|---|---| | $348_{10}$ | -> | HEX | | | $348 \div 16$ | = | $ 21.75$ | = | $21$ r $12$ | | $21 \div 16$ | = | $ 1.3125$ | = | $1$ r $5$ | | $1 \div 16$ | = | | = | $0$ r $1$ | * A -> 10 * D -> 13 * B -> 11 * E -> 14 * C -> 12 * F -> 15 $348_{10} -> 15C_{16}$ ## Arithmetic Operations on Binary Numbers ### 1. Binary Addition: - Binary addition follows the same rules as decimal addition, with the primary difference being that the carry-over occurs when the sum is 2, not 10 as in decimal. - The rules for binary addition are as follows: - $0 + 0 = 0$ - $0 + 1 = 1$ - $1 + 0 = 1$ - $1 + 1 = 0$ (with a carry-over of 1 to the next column) or $10$ - $1 + 1 + 1 = 1$ (with a carry-over of 1 to the next column) or $11$ - $1010 + 1001 = 10011$ in decimal $10 + 9 = 19$ - $100110 + 110101 = 1011011$ in decimal $38 + 53 = 91$ - $101101 + 111101 = ????$ ### 2. Binary Subtraction: - Binary subtraction also follows similar rules to decimal subtraction. However, borrowing occurs when the minuend (the number being subtracted from) is smaller than the subtrahend (the number being subtracted). - The rules for binary subtraction are as follows: - $0 - 0 = 0$ - $1 - 0 = 1$ - $1 - 1 = 0$ - To subtract 1 from 0, borrow 1 from the next higher bit (just like in decimal). #### For example - $10 - 1 = 01$ - $100 - 10 = 010$ - $100 - 1 = ????$ ### Binary Multiplication: - Binary multiplication is similar to decimal multiplication but involves only two digits (0 and 1). - The rules for binary multiplication are as follows: - $0 * 0 = 0$ - $0 * 1 = 0$ - $1 * 0 = 0$ - $1 * 1 = 1$ #### examples: - a diagram of the following binary multiplication calculations: - $110 \times 101 = 11110$ - $1011 \times 10 = 10110$ - $11 \times 10 = 110$ - $11011 \times 1101 = 101011111 $ ### Binary Division: - Binary division is similar to decimal division. It involves dividing a binary number (the dividend) by another binary number (the divisor) to obtain a quotient and a remainder. - The rules for binary division are as follows: - $0 \div 1 = 0$ with a remainder of 0 - $1 \div 1 = 1$ with a remainder of 0 - $0 \div 0$ is undefined (division by zero) - To divide by 1, simply copy the dividend to the quotient and set the remainder to 0. - To divide by 0, the result is undefined. - A diagram of the following binary division calculations: - $11011 \div 101 = 101$ remainder $110$ - $101110111 \div 1011 = 1011$ remainder $111$ - $110110101 \div 1010 = 1001$ remainder $1001$ * $10 \div 1 = 11$ * $101 \div 1 = 11$ * $11 \div 1 = 11$ **Important Note**: *DVD DVR = 1 IF NOT *