1 / 6

Computer Arithmetic

Computer Arithmetic. Integer and Fixed Point P & H: Chapter 3. Single Precision IEEE 754 Example (1). Ex : 3.8125 10 = +1.11101 * 2 1 0 1 0 0 0 0 0 0 0 1 1 1 0 1 0 0 … 0 Sign is 0 (bit position 31  MSB) Exponent is 1 0 0 0 0 0 0 0 (underlined above) 0111 1111 + 0000 0001 = 1000 0000

Download Presentation

Computer Arithmetic

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.

E N D

Presentation Transcript


  1. Computer Arithmetic Integer and Fixed Point P & H: Chapter 3

  2. Single Precision IEEE 754 Example (1) Ex: 3.812510 = +1.11101 * 21 • 0 1 0 0 0 0 0 0 0 1 1 1 0 1 0 0 … 0 • Sign is 0 (bit position 31  MSB) • Exponent is 1 0 0 0 0 0 0 0 (underlined above) • 0111 1111 + 0000 0001 = 1000 0000 • Mantissa is 1.1110100…0 (the leading 1 is assumed in the representation above) • That’s +1.11101 * 2(128-127) = 1.9062510 * 21 = 3.812510

  3. Single Precision IEEE 754 Example (2) Ex: -4.12510 = -0100.001 = -1.00001 * 22 • 1 1 0 0 0 0 0 0 1 0 0 0 0 1 0 0 … 0 • In HEX: C084 0000 (Big Endian) • The exponent is the “unsigned stored value” – 127 = 129 – 127 = 2 • That’s -1.000010 * 2(129-127) = -1.03125 * 22 = -4.125

  4. Exceptions to IEEE 754 • These rules apply when • Exponent  00 • Exponent  FF (= 25510) • Special rules apply for these situations • These special rules provide for • NaN (Not a Number) • +/- Inf (infinity) • +/- 0 (yes, two zeros!) • “unnormalized” numbers  allows very very very small values including “machine epsilon” (the smallest positive number allowed)

  5. Exceptions to IEEE 754 • Special cases: (E is Exponent, F is Mantissa) • If E=255 and F is nonzero, then Value=NaN ("Not a Number") • If E=255 and F is zero and S is 1, then Value=-Infinity • If E=255 and F is zero and S is 0, then Value=Infinity • If E=0 and F is nonzero, then Value=(-1)^S * 2^(-126) * (0.F) These are "unnormalized" values. • If E=0 and F is zero and S is 1, then Value=-0 • If E=0 and F is zero and S is 0, then Value=0

  6. Test Yourself • Using Single Precision IEEE 754, what is FF28 0000 (Big Endian)? • Using Single Precision IEEE 754, what is 8038 0000 (Big Endian)?

More Related