Explore various data representation methods, conversion between number systems, and binary data representation concepts. Learn to convert decimal to binary, octal, and hexadecimal. Practice computations in different numerical systems.
An Image/Link below is provided (as is) to download presentation
Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.Content is provided to you AS IS for your information and personal use only.Download presentation by click this link.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.During download, if you can't get a presentation, the file might be deleted by the publisher.
Goals • Describe numbering systems and their use in data representation • Compare and contrast various data representation methods • Describe how nonnumeric data is represented • Describe common data structures and their uses
Data Representation and Processing • To be processed by the brain, the data must be converted to an appropriate internal format. • Sight • Smell • Taste • Sound • Skin Sensation • Electrical Impulses
Data Representation and Processing • Data and information processors must be able to: • Accept external data and convert it to an appropriate internal format • Store and retrieve data internally • Transport data among internal storage and processing components
Binary Representation of Data • Computers represent data using binary numbers. • Binary numbers correspond directly with values in boolean logic. • Computers combine multiple digits to form a single data value to represent large numbers.
Datarepresentation (การแทนรหัสข้อมูล) NumberSystemandConversion ระบบตัวเลข (NumberSystem) ฐาน (Baseorradix) - ค่าที่จะบอกให้ทราบว่าเลข ในระบบนั้นๆ จะมีสัญลักษณ์ใช้ทั้งหมดกี่ตัว หรือ มีค่า ตัวเลขโดดๆ (absolutevalue) กี่ตัว ระบบจำนวนเลขที่ใช้ในทางคอมพิวเตอร์ ประกอบด้วย ระบบเลขฐานสอง (Binary Number System) ประกอบด้วยเลข 0,1 ระบบเลขฐานแปด (Octal Number System) ประกอบด้วยเลข 0 - 7 ระบบเลขฐานสิบ (Decimal Number System) ประกอบด้วยเลข 0 - 9 ระบบเลขฐานสิบหก (Hexadecimal Number System) ประกอบด้วย ตัว เลข 0 - 9 และ A - F
decimal - The decimal number system uses the radix 10. The 10 symbols are 0,1,2,3,4,5,6,7,8,9. 724.5 = 7x102+2x101+4x100+5x10-1 = 724.5 binary - The binary system uses the radix 2. The two digits symbols used are 0 and 1. 101101 = 1x25 +0x24+1x23+1x22+0x21+1x20 = 45 (เลขฐานสิบ)
hexadecimal - The hexadecimal system uses the radix 16. The 16 symbols used are 0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F F3 = F x 161 + 3 x 160 = 15 x 16 + 3 x 1 = 243 (เลขฐานสิบ) ความสัมพันธ์ระหว่างเลขฐานสิบกับเลขฐานอื่นๆ เขียนเป็นสูตรได้ดังนี้
Conversion - Conversion from decimal to binary, octal, and hexadecimal Example Conversion of decimal 41.6875 into binary Integer = 41 Fraction = 0.6875 2) 41 0.6875 x 2 = 1.3750 2) 20 1 0.3750 x 2 = 0.7500 2) 10 0 0.7500 x 2 = 1.5000 2 ) 5 0 0.5000 x 2 = 1.0000 2) 2 1 2 ) 1 0 0 1 101001.1011
การลบโดยใช้ Complements • The subtraction of two n-digit unsigned numbers M - N • by using r’s complement • M >= N (M = 72532, N = 13250) radix 10 • M = 7 2 5 3 2 • 10’s complement of N = + 8 6 7 5 0 • Sum = 1 5 9 2 8 2 • Discard end carry 105 = -1 0 0 0 0 0 • Answer = 5 9 2 8 2
M < N (M = 13250, N = 72532) • M = 1 3 2 5 0 • 10’s complement of N = + 2 7 4 6 8 • Sum = 4 0 7 1 8 • There is no end carry • Answer is negative 59282 (10’s complement of 40718) • Example 10 - 6 = ? • 6 - 10 = ?
Subtraction with binary number. Using X = 1010100 • and Y = 1000011 • X - Y • X = 1 0 1 0 1 0 0 • 2’s complement of Y = + 0 1 1 1 1 0 1 • Sum = 1 0 0 1 0 0 0 1 • Discard end carry 2^7 = - 1 0 0 0 0 0 0 0 • Answer X - Y = 0 0 1 0 0 0 1
Y - X • Y = 1 0 0 0 0 1 1 • 2’s complement of X = + 0 1 0 1 1 0 0 • Sum = 1 1 0 1 1 1 1 • There is no end carry • Answer is negative 0010001 (2’s complement of 1101111)
Numerical Example for Binary Multiplier Multiplicand B = 10111 E A Q SC Multiplier in Q 0 00000 10011 101 Qn= 1 ;add B 10111 First partial product 0 10111 Shift right EAQ 0 01011 11001 100 Qn = 1 ; add B 10111 Second partial product 1 00010 Shift right EAQ 0 10001 01100 011 Qn = 0 ; shift right EAQ 0 01000 10110 010 Qn = 0 ; shift right EAQ 0 00100 01011 001 Qn = 1 ; add B 10111 Fifth partial product 0 11011 Shift right EAQ 0 01101 10101 000 Final product in AQ = 0110110101
CPU Data Types Five Primitive Data Types: • Integer • Excess Notation • Two’s Complement Notation • Real number • Floating Point Notation • Character • Boolean • Memory address
Integer signed numbers representation When an integer binary number is positive, the sign is represented by 0 and the magnitude by positive binary number. When the number is negative, the sign is represented by 1 and the rest of number may be represented in one of three possible ways: 1. Signed - magnitude representation 2. Signed - 1’s complement representation 3. Signed - 2’s complement representation
Example number 14 +14 0 0001110 -14 In signed - magnitude representation 1 0001110 -14 In signed - 1’s complement 1 1110001 -14 In signed - 2’s complement 1 1110010 sign bit
CPU Data Types Real Numbers: • A real number can contain both whole and fractional components • The whole portion appears to the left of the radix point • The fractional portion appears to the right of the radix point
CPU Data Types Real Numbers: For Example: 18.56 (18 whole portion) (.56 fractional portion)
CPU Data Types Floating Point Notation: • Floating point notation is used to represent very small numbers and very large numbers • Values can either be very large or very small, but not both at the same time
CPU Data Types 0.0000000013526473 Conversion of Scientific notation to decimal notation 13,526,473 x 10-16 0.0000000013526473.0 1352647300000000.0 13,526,473 x 108 13526473.00000000.0