0 index
1 Chapter 4
2 Binary number system
3 Binary number system 2
4 Internal representation
5 COMPUTER ARITHMETIC:Place Values
6 COMPUTER ARITHMETIC:Place Values 2
7 COMPUTER ARITHMETIC:Place Values 3
8 COMPUTER ARITHMETIC:Place Values 4
9 COMPUTER ARITHMETIC:Place Values 5
10 COMPUTER ARITHMETIC:Place Values 6
11 COMPUTER ARITHMETIC:The Base-2 System - Binary
12 COMPUTER ARITHMETIC:The Base-2 System - Binary 2
13 COMPUTER ARITHMETIC:The Base-2 System - Binary 3
14 COMPUTER ARITHMETIC:Base10 => Base2 Conversion
15 COMPUTER ARITHMETIC:Base10 => Base2 Conversion 2
16 COMPUTER ARITHMETIC:Base10 => Base2 Conversion 3
17 COMPUTER ARITHMETIC:Base10 => Base2 Conversion 4
18 COMPUTER ARITHMETIC:Base10 => Base2 Conversion 5
19 COMPUTER ARITHMETIC:Base10 => Base2 Conversion 6
20 COMPUTER ARITHMETIC:Base10 => Base2 Conversion 7
21 COMPUTER ARITHMETIC:Base10 => Base2 Conversion 8
22 COMPUTER ARITHMETIC: Octal Number System
23 COMPUTER ARITHMETIC: Octal Number System - Octal to Decimal
24 COMPUTER ARITHMETIC: Octal Number System - Decimal to Octal
25 COMPUTER ARITHMETIC: Octal Number System - Octal to Binary
26 COMPUTER ARITHMETIC: Octal Number System - Binary to Octal
27 COMPUTER ARITHMETIC: Hexadecimal Number System
28 COMPUTER ARITHMETIC: Hexadecimal Number System - Hexdecimal to Decimal
29 COMPUTER ARITHMETIC: Hexadecimal Number System - Decimal to Hexdecimal
30 COMPUTER ARITHMETIC: Hexadecimal Number System - Hexadecimal to Binary
31 COMPUTER ARITHMETIC: Hexadecimal Number System - Binary to Hexadecimal

outline
created using slideshow.cgi by Andy Harris















CSCI N301 Fundamental CS Concepts: n301/Encoding
1. Chapter 4
  • The Hardware World



































CSCI N301 Fundamental CS Concepts: n301/Encoding
2. Binary number system
  • Base 2 instead of 10
    • 2 digits, 0 and 1
    • BIT (Binary digIT)



































CSCI N301 Fundamental CS Concepts: n301/Encoding
3. Binary number system 2
  • All information stored internally in binary form
    • letters, intergers, decimal numbers, graphic images
    • external/internal encoding/decoding



































CSCI N301 Fundamental CS Concepts: n301/Encoding
4. Internal representation
  • letters A = 01000001
  • integers 65 = 01000001
  • different information but same internal code
  • computer needs to know the data type to know how to interpret (assign meaning)



































CSCI N301 Fundamental CS Concepts: n301/Encoding
5. COMPUTER ARITHMETIC:Place Values
  • number system with five symbols: 0, 1, 2, 3, and 4
  • How would we count 7 coins?
  • 1 stack & 2 coins



































CSCI N301 Fundamental CS Concepts: n301/Encoding
6. COMPUTER ARITHMETIC:Place Values 2
  • How would 24 coins look?
  • Or how about 25 coins?



































CSCI N301 Fundamental CS Concepts: n301/Encoding
7. COMPUTER ARITHMETIC:Place Values 3
  • numerical representaion scheme:
    • 4 = stack-of-stacks
    • 1 = 1 stack of 5
    • 3 = single coins



































CSCI N301 Fundamental CS Concepts: n301/Encoding
8. COMPUTER ARITHMETIC:Place Values 4
  • This idea of giving symbols different values that depends on where they are writen and using zeros to fill the empty positions is called the place-value system.



































CSCI N301 Fundamental CS Concepts: n301/Encoding
9. COMPUTER ARITHMETIC:Place Values 5
  • The stack size of number system is called its base



































CSCI N301 Fundamental CS Concepts: n301/Encoding
10. COMPUTER ARITHMETIC:Place Values 6
  • What number system (base) did we design?



































CSCI N301 Fundamental CS Concepts: n301/Encoding
11. COMPUTER ARITHMETIC:The Base-2 System - Binary
  • Binary Addition:
    ZERO         F        0
    ONE T 1
    TWO TF 10
    THREE TT 11
    FOUR TFF 100
    FIVE ??? ???



































CSCI N301 Fundamental CS Concepts: n301/Encoding
12. COMPUTER ARITHMETIC:The Base-2 System - Binary 2
  • Binary Subtraction:
         24 - 5  =>     ?? + 4 = 24
    Ex: 10101 - 11 => ?????
    + 11
    10101



































CSCI N301 Fundamental CS Concepts: n301/Encoding
13. COMPUTER ARITHMETIC:The Base-2 System - Binary 3
  • Multiplication:
         100001
    _x 101_
    100001
    000000
    + 100001



































CSCI N301 Fundamental CS Concepts: n301/Encoding
14. COMPUTER ARITHMETIC:Base10 => Base2 Conversion
  • Ex: 102410; 678610



































CSCI N301 Fundamental CS Concepts: n301/Encoding
15. COMPUTER ARITHMETIC:Base10 => Base2 Conversion 2
  • Negative Numbers in Binary
  • Three representation schemes are used:
    1. Signed Magnitude
      Left most bit is the sign bit (0 => + & 1 => -).
      Remaining bits hold absolute magnitude.



































CSCI N301 Fundamental CS Concepts: n301/Encoding
16. COMPUTER ARITHMETIC:Base10 => Base2 Conversion 3
  • Ex:     210 => 0000 00102
    -210 => 1000 00102



































CSCI N301 Fundamental CS Concepts: n301/Encoding
17. COMPUTER ARITHMETIC:Base10 => Base2 Conversion 4
    1. One's Compliment
      Sign bit is similar to (1). The magnitude is complimented.



































CSCI N301 Fundamental CS Concepts: n301/Encoding
18. COMPUTER ARITHMETIC:Base10 => Base2 Conversion 5
  • Ex:     410 => 0000 01002
    -410 => 1111 10112



































CSCI N301 Fundamental CS Concepts: n301/Encoding
19. COMPUTER ARITHMETIC:Base10 => Base2 Conversion 6
    1. Two's Compliment
      Sign bit same as (1).
      Magnitude is complimented first and a "1" is added to the complimented digits.



































CSCI N301 Fundamental CS Concepts: n301/Encoding
20. COMPUTER ARITHMETIC:Base10 => Base2 Conversion 7
  • Ex:     710 => 0000 01112
    -710 => 1111 10012



































CSCI N301 Fundamental CS Concepts: n301/Encoding
21. COMPUTER ARITHMETIC:Base10 => Base2 Conversion 8
  • Ex:     7 + -3

    A - B = A + ~B + 1




































CSCI N301 Fundamental CS Concepts: n301/Encoding
22. COMPUTER ARITHMETIC: Octal Number System
  • Base=8
  • 8 Symbols: {0,1,2,3,4,5,6,7}



































CSCI N301 Fundamental CS Concepts: n301/Encoding
23. COMPUTER ARITHMETIC: Octal Number System - Octal to Decimal
  • (an-1an-2 ... a1a0)8 = (an-1x8n-1+an-2x8n-2+ ... +a1x81+a0x80)10
  • Example:
    (127)8 = (1x 82 + 2 x 81 + x 80) = (64 + 16 +)10 = (87)10



































CSCI N301 Fundamental CS Concepts: n301/Encoding
24. COMPUTER ARITHMETIC: Octal Number System - Decimal to Octal
  • Repeated division by 8.
    (Similar to principle to generate binary codes).
  • Example: (213)10 = (what)8?
    1. 213/8 = 26(quotient),5(remainder) => lowest octal number = 5
    2. 26/8 = 3(quitient), 2(remainder) => second octal digit = 2
    3. 3/8 = 0(quotient), 3(remainder) => third octal digit = 3
    Stop, since quotient = 0
    Hence, (213)10 = (325)8



































CSCI N301 Fundamental CS Concepts: n301/Encoding
25. COMPUTER ARITHMETIC: Octal Number System - Octal to Binary
  • Expand each octal digit to 3 binary bits.
  • Example: (725)8 = (111|010|101)2



































CSCI N301 Fundamental CS Concepts: n301/Encoding
26. COMPUTER ARITHMETIC: Octal Number System - Binary to Octal
  • Combine every 3 bits into one octal digit.
  • Example: (110|010|011)2 = (623)8



































CSCI N301 Fundamental CS Concepts: n301/Encoding
27. COMPUTER ARITHMETIC: Hexadecimal Number System
  • Base = 16
  • 16 symbols: {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A(=10), B(=11), C(=12), D(=13), E(=14), F(=15)}



































CSCI N301 Fundamental CS Concepts: n301/Encoding
28. COMPUTER ARITHMETIC: Hexadecimal Number System - Hexdecimal to Decimal
  • (an-1an-2 ... a1a0)16 = (an-1x16n-1+an-2x16n-2+ ... +a1x161+a0x160)10
  • Example:
    (1C7)16 = 1 162 + 12 x 161 + 7 x 160)10 = (256 + 197 + 7)10 = (455)10



































CSCI N301 Fundamental CS Concepts: n301/Encoding
29. COMPUTER ARITHMETIC: Hexadecimal Number System - Decimal to Hexdecimal
  • Repeated division by 16.
    (similar in principle to generating binary and octal codes).
  • Example: (829)10 = (what)16?
    1. 829/16 = 51(quotient),13 = D(remainder) =>
    lowest octal number = D
    2. 51/16 = 3(quitient), 3(remainder) => second octal digit = 3
    3. 3/16 = 0(quotient), 3(remainder) => third octal digit = 3
    Stop, since quotient = 0
    Hence, (829)10 = (33D)16



































CSCI N301 Fundamental CS Concepts: n301/Encoding
30. COMPUTER ARITHMETIC: Hexadecimal Number System - Hexadecimal to Binary
  • Expand each hexadecimal digit to 4 binary bits.
  • Eaxple: (E29)16 = (1110|0100|1001)2



































CSCI N301 Fundamental CS Concepts: n301/Encoding
31. COMPUTER ARITHMETIC: Hexadecimal Number System - Binary to Hexadecimal
  • Combine every 4 bits into one hexadecimal digit.
  • Eample: (0101|1111|1010|0110)2 = (5FA6)16



































outline

Chapter 4

Binary number system

Binary number system 2

Internal representation

COMPUTER ARITHMETIC:Place Values

COMPUTER ARITHMETIC:Place Values 2

COMPUTER ARITHMETIC:Place Values 3

COMPUTER ARITHMETIC:Place Values 4

COMPUTER ARITHMETIC:Place Values 5

COMPUTER ARITHMETIC:Place Values 6

COMPUTER ARITHMETIC:The Base-2 System - Binary

COMPUTER ARITHMETIC:The Base-2 System - Binary 2

COMPUTER ARITHMETIC:The Base-2 System - Binary 3

COMPUTER ARITHMETIC:Base10 => Base2 Conversion

COMPUTER ARITHMETIC:Base10 => Base2 Conversion 2

COMPUTER ARITHMETIC:Base10 => Base2 Conversion 3

COMPUTER ARITHMETIC:Base10 => Base2 Conversion 4

COMPUTER ARITHMETIC:Base10 => Base2 Conversion 5

COMPUTER ARITHMETIC:Base10 => Base2 Conversion 6

COMPUTER ARITHMETIC:Base10 => Base2 Conversion 7

COMPUTER ARITHMETIC:Base10 => Base2 Conversion 8

COMPUTER ARITHMETIC: Octal Number System

COMPUTER ARITHMETIC: Octal Number System - Octal to Decimal

COMPUTER ARITHMETIC: Octal Number System - Decimal to Octal

COMPUTER ARITHMETIC: Octal Number System - Octal to Binary

COMPUTER ARITHMETIC: Octal Number System - Binary to Octal

COMPUTER ARITHMETIC: Hexadecimal Number System

COMPUTER ARITHMETIC: Hexadecimal Number System - Hexdecimal to Decimal

COMPUTER ARITHMETIC: Hexadecimal Number System - Decimal to Hexdecimal

COMPUTER ARITHMETIC: Hexadecimal Number System - Hexadecimal to Binary

COMPUTER ARITHMETIC: Hexadecimal Number System - Binary to Hexadecimal