Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Computer Engineering Expert

All of you are familiar with the transcendental number, e. Many applications in mathematics involve computing various powers of e. It can be proven that 
ex = 1 + x/1 + x2/2! + x3/3! + ...

for all values of x. Of course, this is an infinite sum, so we can't hope to actually sum all of these values up! But the good news is that the later terms get so small that a partial sum can provide a very nice approximation for the value of ex. You are to prepare a single precision function (result returned in $f0) called exp with one single precision parameter (in $f12), along with a little driver program for testing your function. Your function should use the summation formula as an approximation for the value of ex, using the following guide for terminating the summation:
If the next term divided by the summation so far is less that 1.0e-15, then terminate the summation (and don't even bother to add in that next term). [One might be tempted to just stop if the next term is less that 1.0e-15, but my proposed guide is more sensitive to the relative size of the actual summation.]
Even though the summation is valid for all values of x, there is a problem with convergence when you use negative values too small such as -20. Therefore, your exp function should compute the value of e|x| instead, and then invert the result (this process should be handled by the function exp, not by your driver program).
You can expect your program to have overflow problems when tested with values of x somewhere around 90 or -90 (Why?).
Here is a sample execution of my code, and your output should have exactly the same format:
Let's test our exponential function!
Enter a value for x (or 999 to exit): 9
Our approximation for e^9.00000000 is 8103.08300781 
Enter a value for x (or 999 to exit): 0
Our approximation for e^0.00000000 is 1.00000000 
Enter a value for x (or 999 to exit): 3.75
Our approximation for e^3.75 is 42.52108002 
Enter a value for x (or 999 to exit): -1
Our approximation for e^-1.00000000 is 0.36787942 
Enter a value for x (or 999 to exit): 80
Our approximation for e^80.00000000 is 55406214943247279000000000000000000.00000000
Enter a value for x (or 999 to exit): 999
Come back soon!

Submit a separate file called HW7exp_PGavin.asm, if your name is Peter Gavin.

Computer Engineering, Engineering

  • Category:- Computer Engineering
  • Reference No.:- M9116518

Have any Question?


Related Questions in Computer Engineering

A bird is flying around the world at a rate of 256ftmin how

A bird is flying around the world at a rate of 25.6ft/min. How many weeks will it take to compete it's journey if the circumference of the earth is25,000 miles using factor label method.

Question explain why you should always search the free

Question: Explain why you should always search the free space and slack space if you suspect person who deliberately delete file or information on a workstation that you are analyzing. The response must be typed, single ...

On microsoft word what would be the advantage of using the

On Microsoft word, what would be the advantage of using the dialog box over setting various tabs directly on the ruler line? In what types of typing tasks would you find using the ruler line helpful?

Systems and networkscalculate the timeoutinterval for tcp

Systems and Networks Calculate the TimeOutInterval for TCP. Assume the observed SampleRTTs for the first three packets are 2 seconds, 5 seconds, and 8 seconds. The value of a=0.25 and the "safety margin" is 0.5 seconds. ...

Nbspa senior collected data concerning the amount of time

A senior collected data concerning the amount of time students had to wait when adding or dropping courses at the beginning of the semester. The student then built a model of the behavior and experimented different strat ...

The richter scale is often used to measure the strength and

The Richter scale is often used to measure the strength and potential damage caused by an earthquake. Design and write an algorithm which accepts as input a Richter scale reading and then prints a message indicating the ...

What is the purpose of exclusive gates such as the xor and

What is the purpose of exclusive gates such as the XOR and XNOR? What function do these gates perform?

What is a security policy and why is it so critical to the

What is a security policy and why is it so critical to the success of an organization's information security program? Select an Issue Specific Security Policy and describe why an organization should have this issue cover ...

Kelly and jennifer are roommates kelly loves listening to

Kelly and Jennifer are roommates. Kelly loves listening to rock music and uses the radio in their common area to play it. Jennifer, on the other hand, prefers the peace and quiet around the common area. Answer the follow ...

Assignment write an 8-page apa formatted paper on a

Assignment: Write an 8-page APA formatted paper on a business problem that requires data mining, why the problem is interesting, the general approach you plan to take, what kind of data you plan to use, and finally how y ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As