Ch02POCA - 2-1 Chapter 2: Data Representation Principles of...

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

View Full Document Right Arrow Icon
Chapter 2: Data Representation 2-1 Principles of Computer Architecture by M. Murdocca and V. Heuring © 1999 M. Murdocca and V. Heuring Principles of Computer Architecture Miles Murdocca and Vincent Heuring Chapter 2: Data Representation
Background image of page 1

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

View Full DocumentRight Arrow Icon
Chapter 2: Data Representation 2-2 Principles of Computer Architecture by M. Murdocca and V. Heuring © 1999 M. Murdocca and V. Heuring Chapter Contents 2.1 Introduction 2.2 Fixed Point Numbers 2.3 Floating Point Numbers 2.4 Case Study: Patriot Missile Defense Failure Caused by Loss of Precision 2.5 Character Codes
Background image of page 2
Chapter 2: Data Representation 2-3 Principles of Computer Architecture by M. Murdocca and V. Heuring © 1999 M. Murdocca and V. Heuring Fixed Point Numbers • Using only two digits of precision for signed base 10 numbers, the range (interval between lowest and highest numbers) is [-99, +99] and the precision (distance between successive num- bers) is 1. • The maximum error, which is the difference between the value of a real number and the closest representable number, is 1/2 the pre- cision. For this case, the error is 1/2 × 1 = 0.5. • If we choose a = 70, b = 40, and c = -30, then a + (b + c) = 80 (which is correct) but (a + b) + c = -30 which is incorrect. The problem is that (a + b) is +110 for this example, which exceeds the range of +99, and so only the rightmost two digits (+10) are retained in the intermediate result. This is a problem that we need to keep in mind when representing real numbers in a finite representation.
Background image of page 3

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

View Full DocumentRight Arrow Icon
Chapter 2: Data Representation 2-4 Principles of Computer Architecture by M. Murdocca and V. Heuring © 1999 M. Murdocca and V. Heuring Weighted Position Code • The base, or radix of a number system defines the range of pos- sible values that a digit may have: 0 – 9 for decimal; 0,1 for binary. • The general form for determining the decimal value of a number is given by: Example: 541.25 10 = 5 × 10 2 + 4 × 10 1 + 1 × 10 0 + 2 × 10 -1 + 5 × 10 -2 = (500) 10 + (40) 10 + (1) 10 + (2/10) 10 + (5/100) 10 = (541.25) 10
Background image of page 4
Chapter 2: Data Representation 2-5 Principles of Computer Architecture by M. Murdocca and V. Heuring © 1999 M. Murdocca and V. Heuring Base Conversion with the Remainder Method Example: Convert 23.375 10 to base 2. Start by converting the inte- ger portion: 23/2 = 11 R 1 11/2 = 5 R 1 5/2 = 2 R 1 2/2 = 1 R 0 1/2 = 0 R 1 Integer Remainder Least significant bit Most significant bit (23) 10 = (10111) 2
Background image of page 5

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

View Full DocumentRight Arrow Icon
Chapter 2: Data Representation 2-6 Principles of Computer Architecture by M. Murdocca and V. Heuring © 1999 M. Murdocca and V. Heuring Base Conversion with the Multiplica- tion Method • Now, convert the fraction: .375 × 2 = 0.75 .75 × 2 = 1.5 0 .5 × 2 = 1.0 0 Least significant bit Most significant bit (.375) 10 = (.011) 2 • Putting it all together, 23.375 10 = 10111.011 2 .
Background image of page 6
Chapter 2: Data Representation 2-7 Principles of Computer Architecture by M. Murdocca and V. Heuring © 1999 M. Murdocca and V. Heuring Nonterminating Base 2 Fraction • We can’t always convert a terminating base 10 fraction into an equivalent terminating base 2 fraction: .2 .4 .8 .6 .2 .
Background image of page 7

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

View Full DocumentRight Arrow Icon
Image of page 8
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 33

Ch02POCA - 2-1 Chapter 2: Data Representation Principles of...

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

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