代做CNIT 17600 - Intro Computer Architecture - Floating Point Lab代写Python编程
- 首页 >> CSCNIT 17600 - Intro Computer Architecture
Floating Point Lab
Questions
Question 1.
a. Convert the decimal number 17895567.4828儿1020 to the format SEEMMMM with the exponent stored excess-55. The implied decimal point is to the right of the first mantissa digit. Use the standard 0 for positive numbers and 1 for negative. Note carefully the number of digits in the mantissa.
b. What is the smallest number (i.e. closest to zero) you can use with this format before underflow occurs? There should be a positive and a negative version of this smallest num- ber.
c. What is the largest number (i.e. furthest away from zero) you can use with this format before overflow occurs? There should be a positive and a negative version of this largest number.
Question 2.
a. Convert the decimal number −0.00000007830465805儿10−15 to the format
SEEMMMMMM with the exponent stored excess-25. The implied decimal point is at the start of the mantissa. Use the standard 0 for positive numbers and 1 for negative. Note carefully the number of digits in the mantissa.
b. What is the smallest number (i.e. closest to zero) you can use with this format before underflow occurs? There should be a positive and a negative version of this smallest num- ber.
c. What is the largest number (i.e. furthest away from zero) you can use with this format before overflow occurs? There should be a positive and a negative version of this largest number.
Question 3.
a. Convert the decimal number 91611684058 to floating point. Use the format
SEEMMMMM. All digits are decimal. The exponent is being stored excess-49 (not excess- 50). The implied decimal point is at the beginning of the mantissa. The sign is 0 for a positive number, 1 for a negative number. Note carefully the number of digits in the mantissa.
b. What is the range of numbers that can be stored in this format?
c. What is the floating point representation for −91611684058?
d. What is the floating point representation for 0.0000091611684058?
Question 4.
Given the IEEE-754 Single Precision Floating Point number (stored Excess-127) 011111010101011000000000000000002, determine the following:
a.The sign of the mantissa
b.The magnitude of the exponent (convert to base 10)
c.The sign of the exponent
Question 5.
Given the IEEE-754 Single Precision Floating Point number (stored Excess-127) 101111010101011000000000000000002, determine the following:
a.The sign of the mantissa
b.The magnitude of the exponent (convert to base 10)
c.The sign of the exponent
Question 6.
Using an online conversion calculator, find the mantissa values of the IEEE-754 Single Precision Floating Point numbers from Questions 4 & 5
Question 7.
IEEE floating point numbers will occasionally yield incorrect math results when used in computer programs. Using your Raspberry Pi or any other terminal program with access to a python prompt, open the interpreter by typing the word python in the command line. You will get a prompt that shows >>> on a pi or linux. If you do not have something like this installed, you may use an online interpreter such as the one available here: https: //www.programiz.com/python-programming/online-compiler/. A subtle change will be needed if you use this; see note below. Start, for example, with
>>> 0 .1+0 .1
Then try something like
>>>0 .1+0 .2
>>>0 .1+0 .7
>>>0 .3+0 .6
>>>0 .2+0 .7
Note - if using the online interpreter/compiler, you will need to actually create a script of sorts. Rather than just typing in the math problem, you will need to assign the sum to a variable:
x=0 .1+0 .2 print(x)
What happened when you tried to sum these pairs of numbers? Summarize these results in a table. Explain why this happened. Use lecture notes and other resources to find the cause of this phenomenon.
Extra credit is available if you can find additional examples of this phenomenon in Python on the Raspberry Pi.
Submission of answers
Type your answers in a separate document. Be sure to submit in PDF format to the LMS.