Question: Write a JavaScript function sigLoss(x, y) that estimates the number of base 10 digits of precision loss in doing the subtraction x - y, according

Write a JavaScript function sigLoss(x, y) that estimates the number of base 10 digits of precision loss in doing the subtraction x - y, according to the estimate just mentioned.. (You will need the standard library function Math.log which calculates the natural logarithm function.) Of course, sigLoss(x, y) will return fractional values even though we are estimating an integer quantity. Fill in the table:

Before modifying the routine, use it to calculate sine(a, 150) with a = 5, 10, 20, 40 and the calculate the relative errors in approximating Math.sin of the same values. The relative errors should be about 1.505e-15, 4.771e-13, , and 0.467 respectively.

Write a JavaScript function sigLoss(x, y) that estimates the number of base

a. Write a JavaScript function sigLoss (x, y) that estimates the number of base 10 digits of precision loss in doing the subtraction x-y, according to the estimate just mentioned.- (You will need the standard library function Math.log which calculates the natural logarithm function. Of course, sigLoss (x, y) will return fractional values even though we are estimating an integer quantity. Fill in the table sigLoss (5,4) sig Loss 1.123567) (1.123456, sigLoss (1.123456,-1.123567) Are these the values you would have expected? b. There are many ways to express a Horners method evaluation of the Taylor polynomial of the sine function. For consistency, use this version: var sine- function (x, n) var k sum 1; for (k n: k 0 --k) x*x/ ((2*k 1) 2 k) sum. return x sum: Before modifying the routine, use it to calculate sine(a, 1500 with a -5, 10, 20, 40 and the calculate the relative errors in approximating Math.sin of the same values. The relative errors should be about 1.505e-15, 4.771e-13, and 0.467 respectively

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!