cs2100-2-Number-Systems-and-Codes

cs2100-2-Number-Systems-and-Codes - CS2100Computer...

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

View Full Document Right Arrow Icon
CS2100 Computer  Organisation http://www.comp.nus.edu.sg/~cs2100/ Number Systems and Codes (AY2009/2010) Semester 2
Background image of page 1

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

View Full DocumentRight Arrow Icon
CS2100 Number Systems and Codes 2 NUMBER SYSTEMS & CODES Information Representations Number Systems Base Conversion Negative Numbers Excess Representation Floating-Point Numbers Decimal codes: BCD, Excess-3, 2421, 84-2-1 Gray Code Alphanumeric Code Error Detection and Correction (not in book)
Background image of page 2
CS2100 Number Systems and Codes 3 INFORMATION REPRESENTATION (1/3) Numbers are important to computers Represent information precisely Can be processed Examples Represent yes or no : use 0 and 1 Represent the 4 seasons: 0, 1, 2 and 3 Sometimes, other characters are used Matriculation number: 8 alphanumeric characters (eg: U071234X)
Background image of page 3

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

View Full DocumentRight Arrow Icon
CS2100 Number Systems and Codes 4 INFORMATION REPRESENTATION (2/3) Bit ( Bi nary d igit) 0 and 1 Represent false and true in logic Represent the low and high states in electronic devices Other units Byte : 8 bits Nibble : 4 bits (seldom used) Word : Multiples of byte (eg: 1 byte, 2 bytes, 4 bytes, 8 bytes, etc.), depending on the architecture of the computer system
Background image of page 4
CS2100 Number Systems and Codes 5 INFORMATION REPRESENTATION (3/3) N bits can represent up to 2 N values. Examples: 2 bits represent up to 4 values (00, 01, 10, 11) 3 bits rep. up to 8 values (000, 001, 010, …, 110, 111) 4 bits rep. up to 16 values (0000, 0001, 0010, …., 1111) To represent M values, log 2 M bits are required. Examples: 32 values requires 5 bits 64 values requires 6 bits 1024 values requires 10 bits 40 values how many bits? 100 values how many bits?
Background image of page 5

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

View Full DocumentRight Arrow Icon
CS2100 Number Systems and Codes 6 DECIMAL (BASE 10) SYSTEM (1/2) A weighted-positional number system Base or radix is 10 (the base or radix of a number system is the total number of symbols/digits allowed in the system) Symbols/digits = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 } Position is important, as the value of each symbol/digit is dependent on its type and its position in the number Example, the 9 in the two numbers below has different values: (759 4) 10 = (7 × 10 3 ) + (5 × 10 2 ) + (9 × 10 1 ) + (4 × 10 0 ) (9 12) 10 = (9 × 10 2 ) + (1 × 10 1 ) + (2 × 10 0 ) In general, (a n a n-1 … a 0 . f 1 f 2 … f m ) 10 = (a n x 10 n ) + (a n-1 x10 n-1 ) + … + (a 0 x 10 0 ) + (f 1 x 10 -1 ) + (f 2 x 10 -2 ) + … + (f m x 10 -m )
Background image of page 6
CS2100 Number Systems and Codes 7 DECIMAL (BASE 10) SYSTEM (2/2) Weighing factors (or weights) are in powers of 10: … 10 3 10 2 10 1 10 0 . 10 -1 10 -2 10 -3 To evaluate the decimal number 593.68, the digit in each position is multiplied by the corresponding weight: 5 × 10 2 + 9 × 10 1 + 3 × 10 0 + 6 × 10 -1 + 8 × 10 -2 = (593.68) 10
Background image of page 7

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

View Full DocumentRight Arrow Icon
CS2100 Number Systems and Codes 8 OTHER NUMBER SYSTEMS (1/2) Binary (base 2) Weights in powers of 2 Binary digits (bits): 0, 1 Octal (base 8) Weights in powers of 8 Octal digits: 0, 1, 2, 3, 4, 5, 6, 7 .
Background image of page 8
Image of page 9
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 02/27/2011 for the course CS 2100 taught by Professor Shivakumar during the Spring '11 term at IIT Kanpur.

Page1 / 78

cs2100-2-Number-Systems-and-Codes - CS2100Computer...

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

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