Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Exploring floating-point numbers 1. Suppose we use a 10-digit floating point representation. The first digit is reserved for the sign; we will assume that we have 6 digits for the mantissa and 3 digits for the exponents (including its sign). Fill in the following table. Two examples are included. #1 #2 #3 #4 #5 #6 #7 #8 Decimal number - 0.21045 5,689,457 - 0.00889021 91,098,000 12,098,810,199 2.39 10-123 Sign + 2 5 1 6 + 4 1 4 0 Mantissa 0 4 5 8 9 4 2 0 0 2 0 2 0 6 Exponent - 0 6 + 0 1 0 1 + - 0 1 2 2 2. What happened when #2 or #5 are converted to the floating-point representation? Because the length of the mantissa is limited the precision of a number is limited. This means in particular that distinct real numbers can have the same floating point representation. Give two numbers that have same floating point representation as 5,689,457. 3. What happens when you attempt to convert #6 to its floating-point representation? Because the length of the exponents is limited, the range of a number is limited. This means that numbers greater than a certain bound or smaller than a certain bound cannot be represented with the given floating-point representation. With the floating-point representation defined as in question1, what are the largest and the smallest positive numbers that can be represented? 4. Precision versus range – We will consider a different 10-digit floating point representation. Assume that the mantissa is now 4- digit long and the exponent is 5-digit long. a) What is the floating point representation of 5,689,457? b) Do the two numbers that you found in question 2 (with same floating-point representation as 5689457) have still the same floating-point representation? Exploring floating-point numbers c) Can you find two numbers that have same floating-point representation with our new representation (i.e., 4-digit mantissa and 5-digit exponent) but have different floating-point representation for the old one (i.e., 6-digit mantissa and 3-digit exponent)? d) Use your answers from question b) and c) to explain how the precision of the two floating-point representations compare. e) For the new floating-point representation, what are the largest and the smallest positive numbers that can be represented? How do they compare with the numbers you found in question 3. f) Explain in your own words what effect increasing the number of digits reserved to the exponent and therefore decreasing the number of digits reserved to the mantissa has on the precision and the range of numbers that can be represented? 5. Use the Casio ClassPad 300 emulator on the computer. Calculators, as computer, store real numbers using a floating-point representation. Let’s explore the limitation of the Casio calculator. One way to create large number is through exponentiation (i.e., raising to a power). Bacteria reproduce at an exponential rate. Assume that a biologist cultivates some bacteria in her laboratory and that the number of bacteria after n minutes is given by 𝑃(𝑛) = 150(1.017)𝑛 . (This formula indicates that the initial number of bacteria was 150 and the number of bacteria increases at a rate of 1.7% per minute.) a) Use the Casio emulator to compute the number of bacteria after one hour. b) Use the Casio emulator to compute the number of bacteria after one day. c) Use the Casio emulator to compute the number of bacteria after one month (30 days). Can you explain the answer you get?