Write a double precision function (result returned in $f0) with one double 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 sin(x). If the absolute value of the next term is less than 1.0e-15, then terminate the summation. Even though the summation is valid for all values of x, there is a problem with convergence when you use values of x having absolute values greater than 30 or so. You may assume that we will test your program with values within this range.
(sample execution)
Enter a (radian) value for x (or 999 to exit): 0
Our approximation for sin(0) is 0
Enter a (radian) value for x (or 999 to exit): 1
Our approximation for sin(1) is 0.8414709848078965
Enter a (radian) value for x (or 999 to exit): -10
Our approximation for sin(-10) is 0.54402111088906224
Enter a (radian) value for x (or 999 to exit): 1.570796326794896 [?/2]
Our approximation for sin(1.5707963267948959) is 1
Enter a (radian) value for x (or 999 to exit): -.5232
Our approximation for sin(-0.5232) is -0.49965461045512305
Enter a (radian) value for x (or 999 to exit): -.5235987755982988 [-?/6]
Our approximation for sin(-0.52359877559829882) is -0.5
Enter a (radian) value for x (or 999 to exit): 999
Exit