NUMBER SYSTEMS and DATA REPRESENTATION for COMPUTERS
Total Page:16
File Type:pdf, Size:1020Kb
NUMBER SYSTEMS and DATA REPRESENTATION for COMPUTERS 05 March 2008 Number Systems and Data Representation 2 Table of Contents Table of Contents .............................................................................................................2 Prologue.............................................................................................................................8 Number System Bases Introduction............................................................................12 Base 60 Number System ..........................................................................................12 Base 12 Number System ..........................................................................................14 Base 6 (Senary) Number System ............................................................................15 Base 3 (Trinary) Number System ............................................................................16 Base 1 Number System.............................................................................................17 Other Bases.................................................................................................................18 Know Nothing ..............................................................................................................18 Indexes and Subscripts .................................................................................................19 Common Number Systems for Computers ................................................................20 Decimal Numbers .......................................................................................................20 Binary Numbers ..........................................................................................................20 Hexadecimal Numbers ..............................................................................................20 Octal Numbers ............................................................................................................21 Numbers Names.........................................................................................................21 Decimal Numbers 0 through 15 and Equivalent Hexadecimal and Binary Numbers ..........................................................................................................................23 Memorization...............................................................................................................23 Pattern Recognition Method.....................................................................................24 Position Value Addition..............................................................................................24 Counting Method ........................................................................................................24 Binary Addition ........................................................................................................25 Sample Binary Addition Problems....................................................................25 Abstract Counting in Base 4..................................................................................27 Conversion Between Binary and Hexadecimal.........................................................29 Data Representation......................................................................................................32 A Little Byte of History................................................................................................32 Character Codes.........................................................................................................33 EBCDIC, US-ASCII, and UNICODE Character Codes ........................................36 Jubilation Code and Gran Zeff Code.......................................................................38 Additional Information About Codes........................................................................41 Positional Number Systems .........................................................................................42 Decimal Number System...........................................................................................42 Algebra Review of Exponents ..................................................................................43 Positional Number System General Concept ........................................................43 Binary Number System..............................................................................................44 Hexadecimal Number System..................................................................................46 Octal Number System................................................................................................48 Fun Questions .............................................................................................................48 Sexagesimal or Sexagenary System ......................................................................48 Nothing Matters...........................................................................................................49 Conversion to Decimal ..................................................................................................50 Number Systems and Data Representation 3 Converting From Decimal: Method of Successive Division.....................................51 Converting Decimal Numbers (Base 10) to Binary (Base 2) ...............................51 Converting Decimal Numbers (Base 10) to Hexadecimal (Base 16).................53 Converting Decimal Numbers (Base 10) to Octal (Base 8) .................................56 Converting Decimal Numbers (Base 10) to Base 4 ..............................................57 Checklist for Converting from Decimal to Another Base Number System ........58 Conversion From Decimal Problems ...................................................................59 Conversion Between Base 4, Binary, and Hexadecimal......................................60 Conversion Between Octal and Binary...................................................................62 Strings ..............................................................................................................................64 String Operations........................................................................................................65 Length.......................................................................................................................65 Concatenation..........................................................................................................65 Truncation................................................................................................................65 LEFT Truncation..................................................................................................66 RIGHT Truncation...............................................................................................66 Extraction..............................................................................................................66 Comparison..............................................................................................................67 String Direction ....................................................................................................67 Inequality Comparisons ......................................................................................67 String Search.......................................................................................................68 Compound Expressions .....................................................................................69 String Function Problems ......................................................................................70 Storage of Multibyte Words: Big Endian, Little Endian.............................................72 Logic Operations ............................................................................................................73 AND Operation............................................................................................................73 AND Applications ....................................................................................................74 OR Operation..............................................................................................................75 OR Applications.......................................................................................................76 NOT Operation............................................................................................................76 NOT Applications ....................................................................................................77 Logic Operation Problems.........................................................................................77 Boolean Algebra Theorems ......................................................................................77 Exclusive OR (XOR) Operation................................................................................78 Real Logic Components ............................................................................................79 NAND Operation.........................................................................................................79 NOR Operation ...........................................................................................................80 Logic Operation Summary........................................................................................81 Hexadecimal Addition....................................................................................................82