Bits Bytes How Computers Represent Data Data Representation
Bits & Bytes How Computers Represent Data
Data Representation How do computers represent data? Computers are digital and use electricity: § § Recognize only two discrete states: on or off Use binary system with two unique digits: 0(off) and 1(on), called bits (binary digits)
Data Representation What is a byte? § § 8 bits grouped together as a unit Provides 256 different combinations of 0 s and 1 s Allows representation of 256 individual characters Numbers, uppercase/lowercase letters and punctuation marks
Data Representation Decimal – base 10 Each position can have 10 values: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 Binary – base 2 Each position can have 2 values: 0, 1 Hexadecimal – base 16 Each position can have 16 values: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F Decimal Hex Binary 000 001 002 003 004 005 006 007 008 009 010 011 012 013 014 015 016 017 018 019 020 00 01 02 03 04 05 06 07 08 09 0 A 0 B 0 C 0 D 0 E 0 F 10 11 12 13 14 00000001 00000010 00000011 00000100 00000101 00000110 00000111 00001000 00001001 00001010 00001011 00001100 00001101 00001110 00001111 00010000 00010010 00010011 00010100
Decimal vs Binary Decimal – base 10 Each position can have 10 values: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 103 (thousand) 102 (hundred) 101 (ten) 100 (one) 0 1 2 3 Binary – base 2 Each position can have 2 values: 0, 1 (one hundred twenty-eight) 27 26 (sixtyfour) 25 (thirtytwo) 24 (sixteen) 23 (eight) 22 (four) 21 (two) 20 (one) 0 1 1 Conversion - 12310 = 011110112 Decimal (base 10) Binary (base 2) 123 = 01111011
Data Representation Decimal / Place Value 2^0 2^1 2^2 2^3 2^4 2^5 2^6 2^7 2^8 2^9 2^10 2^11 2^12 2^13 2^14 2^15 2^16 2^17 2^18 2^19 2^20 2^21 2^22 2^23 2^24 2^25 1 2 4 8 16 32 64 128 256 512 1, 024 2, 048 4, 096 8, 192 16, 384 32, 768 65, 536 131, 072 262, 144 524, 288 1, 048, 576 2, 097, 152 4, 194, 304 8, 388, 608 16, 777, 216 33, 554, 432 Decimal / Place Value 2^26 2^27 2^28 2^29 2^30 2^31 2^32 2^33 2^34 2^35 2^36 2^37 2^38 2^39 2^40 2^41 2^42 2^43 2^44 2^45 2^46 2^47 2^48 2^49 2^50 2^51 67, 108, 864 134, 217, 728 268, 435, 456 536, 870, 912 1, 073, 741, 824 2, 147, 483, 648 4, 294, 967, 296 8, 589, 934, 592 17, 179, 869, 184 34, 359, 738, 368 68, 719, 476, 736 137, 438, 953, 472 274, 877, 906, 944 549, 755, 813, 888 1, 099, 511, 627, 776 2, 199, 023, 255, 552 4, 398, 046, 511, 104 8, 796, 093, 022, 208 17, 592, 186, 044, 416 35, 184, 372, 088, 832 70, 368, 744, 177, 664 140, 737, 488, 355, 328 281, 474, 976, 710, 656 562, 949, 953, 421, 312 1, 125, 899, 906, 842, 620 2, 251, 799, 813, 685, 250
Kilo, Mega, Giga, Tera … Storage of data (bits & bytes) is often categorized as: Kilo (KB) ◦ Roughly 1, 000; actually 210 (1, 024) Mega (MB) ◦ Roughly 1, 000; actually 220 (1, 048, 576) Giga (GB) ◦ Roughly 1, 000, 000; actually 230 (1, 073, 741, 824) Tera (TB) ◦ Roughly 1, 000, 000; actually 240 (1, 099, 511, 627, 776) Peta (PB) ◦ Roughly 1, 000, 000; actually 250 (1, 125, 899, 900, 000) Exa, Zetta, Yotta…
Text Representation What are the popular coding systems to represent § ASCII (8 bit) - American Standard Code for Information text? Interchange - most common today (typically only uses 7 bits) § EBCDIC (8 bit) - Extended Binary Coded Decimal Interchange Code – IBM mainframes § Unicode (16 bit) – newer coding scheme capable of representing all world’s languages
Text Representation - ASCII Decimal | Hexadecimal | Character | Binary http: //www. beginningtoseethelight. org/ascii/index. htm
Text Representation – ASCII Extended Decimal | Hexadecimal | Character | Binary http: //www. beginningtoseethelight. org/ascii/index. htm
Text Representation – Unicode includes same codes as ASCII with either a prefixed or suffixed null character as well as many others http: //www. beginningtoseethelight. org/ascii/index. htm
ASCII <> Unicode TU in ASCII T U 01010100 0101 TU in Unicode (big endian) T 000001010100 U 00001010101 TU in Unicode (Little endian) T U 01010100000 01010000
Representing Images Pixels - picture element § Grid of small points (dots) that make up an image § More pixels results in clearer /more precise image Two Methods § Bit-mapped graphics § Use bytes – each pixel represented by an array of bits § Vector graphics § Image comprised of points, lines, curves, and shapes § Use mathematical formulas to define and represent image
- Slides: 13