Question
What would be the IEEE 754 single precision floating point representation of n = -76543210.9876543210 1234 1018? For explanation, I want you to document the
What would be the IEEE 754 single precision floating point representation of n = -76543210.9876543210 1234 1018? For explanation, I want you to document the steps your perform, in this order: (1) What is n in decimal fixed point form (ddd.ddddd); (2) What is n in binary fixed point form (bbb.bbbb), storing the first 25 bits following the binary point; (3) What is the normalized binary number, written in the form 1.bbbbb...bbb 2e , storing 25 bits following the binary point? (4) What are the 23 mantissa bits, after the bits in bit positions -24, -25, ... are eliminated using the round to nearest, ties to even mode; exclude the 1. part which is not stored; (5) What is the biased exponent in decimal and in binary? (6) Write the 32-bits of the number in the order: s e m; and (7) Write the final answer as an 8- hexdigit number.
Appendix A IEEE 754 Rounding Modes Review IEEE 754 rounding modes discussed in 3.5 of the Chapter 3 lecture notes. Here is an algorithm I hope will help you learn how round to nearest, ties to even rounding mode works. -- When converting a number in decimal to binary floating point representation, after the number has been converted -- to binary normalized form, the number will be something like 1.mmmm...m 2e , where the 25 m bits following the -- binary point are the input to this function. m-1:-25 are the 25-bits mantissa bit following the binary point (the first -- bit following the binary point is in bit position -1, the second bit following the binary point is in bit position -2, ..., -- and the twenty-fifth bit is in bit position -25. The return value n-1:-23 is the 23-bit mantissa which has been rounded -- using the round to nearest, ties to even rounding mode. function round_mantissa (input: m-1:-25) returns n-1:-23 -- 25 mantissa bits are input, only 23 are stored if m-24:-25 = 002 or m-24:-25 = 012 then -- round down to nearest number (this is equivalent to truncation) n-1:-23 m-1:-23 -- the rounded mantissa is just the 23 bits following the binary pt in m elseif m-24:-25 = 112 then -- round up to nearest number (adding 1 to m-1:-23 does the job) n-1:-23 m-1:-23 + 1 elseif m-23 = 0 then -- else, m-24:-25 is 102 so we have a tie; m-23 being 0 means m-1:-23 is even n-1:-23 m-1:-23 -- since m-1:-23 is even we round to even (which is equivalent to truncation) else -- else, m-24:-25 is 102 so we have a tie; m-23 being 1 means m-1:-23 is odd n-1:-23 m-1:-23 + 1 -- round up to nearest even number (adding 1 to m-1:-23 does the job) end if return n-1:-23 end function For example, consider m-1:-25 = 1010101010101010101010101 where bits m-24:-25 are underlined and bits m-22:-23 are in bold. The first conditional expression checks to see if m-24:-25 is 002 or 012 and since m-24:-25 is 012, the conditional expression is true. Therefore, we eliminate bits in m following bit position -23 by rounding down to the nearest number, which is equivalent to truncating m-24:-25 so n-1:-23 m-1:-23 = 10101010101010101010101 (notice m-22:-23 remain unchanged). Another example, consider m-1:-25 = 1010101010101010101010111. The first conditional expression checks to see if m-24:-25 is 002 or 012 and is false; the second conditional expression checks to see if m-24:-25 is 112, which it is. Therefore, we eliminate bits in m following bit position -23 by rounding up to the nearest number, which is equivalent to adding 1 to m-24:-25 so n-1:- 23 m-1:-23 + 1 = 10101010101010101010101 + 1 = 10101010101010101010110 (notice m-22:-23 changed from 012 to 102). A tie occurs when m-24:-25 = 102 and to break the tie, we must round m to the nearest even number. To tell if m-1:-23 is even or odd, it is sufficient to determine if m-23 = 0 or 1, respectively. (Remember, an even binary integer is divisible by 2 and a binary integer that is divisible by 2 will have a 0 in the lsb. If the integer is odd, the lsb will be 1.) When m-24:-25 = 102 and m-23 is 0 (meaning m-1:-23 is even), we break the tie by rounding to the nearest even number via truncation, i.e., n-1:-23 m-1:- 23 will make n-1:-23 an even number. On the other hand, when m-24:-25 = 102 and m-23 is 1 (meaning m-1:-23 is odd), and because we round the to nearest even number, n-1:-23 m-1:-23 + 1 will make n-1:-23 an even number. For example, suppose m-1:-23 is 1010101010101010101010110. Since m-24:-25 = 102, we have a tie (m could be rounded up or rounded down, and either way, the introduced roundoff error would be the same). We next examine m-23 and see that it is 1, indicating that m-1:-23 is odd. Therefore, we break the tie by rounding m-1:-23 to the nearest even number which is accomplished by adding 1 to m-1:-23 resulting in n-1:-23 m-1:-23 + 1 10101010101010101010101 + 1 = 1010101010101010 1010110. Conversely, suppose m-1:-23 is 1010101010101010101011010. Since m-24:-25 = 102 we have a tie. We next examine m-23 and see that it is 0 indicating that m-1:-23 is even. Therefore, we break the tie by rounding m-1:-23 to the nearest even number which is accomplished by truncating bits m-24:-25 resulting in n-1:-23 m-1:-23 = 10101010101010101010110.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started