Representing Information as Bit Patterns Lecture 4 CSCI 1405, CSCI 1301 Introduction to Computer Science Fall 2009
Representing Text Each of the different symbols in the text is assigned a unique bit pattern 1.American Standard code for Information Interchange (ASCII Code): 1 byte- 256 different patterns 2.Unicode Code: 2 bytes- 65,535 different patterns 3.ISO Code: 4 Bytes- Billions of different patterns
Representing Numeric Values Store numeric information in a form of binary notation such as (2’complement, floating point) These notations are built on the basis of binary system
Binary System –Represent quantities: ex: ( ) 2 = (32) 10 –Has only two digits 0 and 1 –The binary number is a weighted number –The position of the 0 or 1 indicates its weight or value within the number –Right most bit= least significant bit LSB: has a weight of 2 0 –Left most bit= most significant bit MSB –The weights increase from right to left
Counting in Binary Decimal SystemBinary System With n numbers of bits you can count up to a number equals to 2 n -1
Binary Fractions Binary fraction number are placed to the right of the binary point MSB of binary fraction number has a weight of 2 -1 ex: (.0101) 2 = (.3125) 10 MSB
Binary to Decimal ( ) 2 = = (109) 10
Binary to Decimal (.1011) 2 = = (0.6875( 10
Decimal to Binary 1.Sum of Weights Method As described before
Decimal to Binary 19=19/2 14=9/2 02=4/2 01=2/2 10=1/2 LSBMSB (19) 10 = (10011) 2 Remainder
Decimal to Binary 0.625X 2 = X 2 = X 2 = X 2 =.5 LSBMSB (.3125) 10 = (.0101) 2 Carry
Thank You