LEC20080915 - Introduction to Computer Programming...

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

View Full Document Right Arrow Icon
Introduction to Computer Programming September 15, 2008 CSC180 Fall 2008, University of Toronto
Background image of page 1

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

View Full DocumentRight Arrow Icon
Numeral systems Let b be the base of a number, and d be a digit of the number. Binary: b = 2 , d ∈ { 0 , 1 } Octal: b = 8 , d ∈ { 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 } Decimal: b = 10 , d ∈ { 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 } Hexadecimal: b = 16 , d ∈ { 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 ,A,B,C,D,E,F } Any base: b = B , B 2 , d ∈ { 0 ,...,B - 1 } CSC180 Fall 2008, University of Toronto 1
Background image of page 2
( d n d n - 1 ··· d 1 d 0 .f 1 f 2 ··· f m - 1 f m ) b = n i =0 d i · b i + m j =1 f j · b - j , where d i ∈ { 0 ,...,b - 1 } , 0 i n , and f j ∈ { 0 ,...,b - 1 } , 1 j m . The above formula can be used to convert a base- b number to a decimal number, where b can be any integer no less than 2. (12 . 34) 10 = 1 · 10 1 + 2 · 10 0 + 3 · 10 - 1 + 4 · 10 - 2 = 12 . 34 (1010 . 0101) 2 = 1 · 2 3 +0 · 2 2 +1 · 2 1 +0 · 2 0 +0 · 2 - 1 +1 · 2 - 2 +0
Background image of page 3

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

View Full DocumentRight Arrow Icon
Image of page 4
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 01/10/2011 for the course CSC 180 taught by Professor Na during the Fall '01 term at University of Toronto- Toronto.

Page1 / 8

LEC20080915 - Introduction to Computer Programming...

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

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