W02-03_Numbers+Ch02CAO

W02-03_Numbers+Ch02CAO - 03 Numbers Systems CSC 230...

Info iconThis preview shows pages 1–13. Sign up to view the full content.

View Full Document Right Arrow Icon
03 Numbers Systems CSC 230 Department of Computer Science University of Victoria 1
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Integer Number Systems ecimal Decimal Base: 10 Digits: 0,1,2,3,4,5,6,7,8,9 Binary Octal Base: 2 Base: 8 ase ase 8 Digits: 0,1 Digits: 0,1,2,3,4,5,6,7 exadecimal Hexadecimal Base: 16 Digits: 0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F 2
Background image of page 2
Small Trivial Example 7423 in decimal = 3 + 3 + 3 x 10 0 + 20 + 400 + 2 x 10 + 4 x 100 + 2 x 10 1 + x 10 2 7000 = 7 x 1000 4 x 10 + 7 x 10 3 3
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Integer Number Systems: Base 10 - Decimal −− = n1 n2 1 0 Integer D D D D Positional Number Systems e.g. 7423 in decimal Base 10: × 1 D1 0 × 0 0 2 0 1 0 ( ) 0 ( ) 0 ( ) ( ) 1 ( ) ( ) + ×+ × 10 21 0 31 0 ( ) 3 10 7423 7 10 ( ) + × 2 41 0 4
Background image of page 4
Integer Number Systems: Base 16 - Hexadecimal −− = n1 n2 1 0 Integer D D D D Positional Number Systems e.g. 8254 in exadecimal hexadecimal Base 16: ( ) ( ) ( ) ( ) 1 0 1 0 D1 6 D 1 6 D 1 6 D 1 6 ×+ × + + × + × ( ) ( ) ( ) ( ) + × + × 32 1 0 16 8254 8 16 2 16 5 16 4 16 () ( ) ( ) ( ) + × + × = 10 8 4096 2 256 5 16 4 1 33,364 5 NOTE: we have converted from hex to decimal!
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Integer Number Systems: Base 2 - Binary ositional Number Systems −− = n1 n2 1 0 Integer D D D D Positional Number Systems e.g. 011011 in binary 1 0 1 1 0 D2 D 2 D 2 D 2 ×+ × + + × + × Base 2: ( ) ( ) ( ) ( ) = 011011 2 ( ) ( ) ( ) ( ) ( ) ( ) = × + × 543 21 0 0 2 12 0 2 () ( ) ( ) ( )( ) ( ) = × + × +×= 10 0 3 2 11 6 18 0 4 2 7 6 NOTE: we have converted from binary to decimal!
Background image of page 6
Weighted Positional Representation BASE: defines the range of values for digits (e.g. 0 – 9 for decimal; 0,1 for binary) GENERAL FORM AS AN n-BIT VECTOR: = BASE n i i Integer Decimal Value d B = × 1 B = BASE i = 0 d = DIGIT n 1 i i im Decimal Value d B =− = × Include fractions . + × 21 0 1 2 10 145 52 1 10 4 10 5 10 5 10 2 10 Full example: 7 .. =+ + + + 100 40 5 0 5 0 02
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Memorize This Table! Binary Decimal Hexadecimal 0000 0 0 0001 1 1 0010 2 2 0011 3 3 0100 4 4 0101 5 5 0110 6 6 0111 7 7 1000 8 8 1001 9 9 1010 10 A 1011 11 B 1100 12 C 1101 13 D 8 1110 14 E 1111 15 F
Background image of page 8
Summary 1: Conversion from any Base “B” Decimal B to Decimal Î Use the polynomial expansion in Base “B” as shown ase “” ives the powers of the positional ystemB Base gives the powers of the positional systemB 1 23 ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) + × + × 01 16 7423 3 16 2 16 4 16 7 16 31 21 6 4 2 5 6 74 0 9 6 = 10 29,731 ( ) ( ) ( ) ( ) + × + 2 5 6 7 11001011 1 2 1 2 0 2 1 2 9 ( ) ( ) ( ) ( ) ×+ × + ×= 45 10 0 2 0 2 12 2 0 3
Background image of page 9

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Conversion from One Base to Another Decimal to Base “B” for positive integers 1. Repeated division by base “B” 2. Collect remainders 3. Form result from right to left Example 1: from decimal to binary 35 10 = ??? 2 5/2 = 17 mainder 35/2 17 + remainder 1 17/2 = 8 + remainder 1 8/2 = 4 + remainder 0 4/2 = 2 + remainder 0 2/2 = 1 + remainder 0 10 1/2 = 0 + remainder 1 answer: 100011 2
Background image of page 10
Conversion from One Base to Another Decimal to Base “B” for positive integers 1. Repeated division by base “B” 2. Collect remainders 3. Form result from right to left Example 2: from decimal to hexadecimal 35 10 = ??? 16 35/16 = 2 + remainder 3 2/16 = 0 + remainder 2 answer: 23 16 11
Background image of page 11

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Conversion amongst binary, octal and hexadecimal is straightforward ± since 8 = 2 3 it takes 3 bits to represent the 8 octal digits 0 . . 7 ± Since 16 = 2 4 it takes 4 bits to represent the 16 hex digits 0 . . F from binary to octal : form groups of 3 bits from right left nd encode each from binary to hexadecimal : form groups of 4 bits from ight to left nd encode each to left and encode each
Background image of page 12
Image of page 13
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 37

W02-03_Numbers+Ch02CAO - 03 Numbers Systems CSC 230...

This preview shows document pages 1 - 13. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online