Question: Test your programs with different values. For now, the speed of your programs is irrelevant. So don't spend time on optimization Your programs must be


Test your programs with different values. For now, the speed of your programs is irrelevant. So don't spend time on optimization Your programs must be well structured. Use ctrl-x t in Emacs or a similar command in your editor of choice to pretty-print it Marks are assigned to functionality and program appearance In case your program hangs, use ctrl-c to terminate it Submit pl.c p2.c on eClass by the end of the lab You can submit as often as you want. We will only consider the last submission for marking Problem 2 [*] (5 marks): log(x) In file p2.c write a function double mylog(double x) that approximates the natural logarithm of x (log(x)), where x is a double floating point value in [0.1, 1), using a 1-2 log(x) = -( = (1 x)2 (1 x)3 + + 2 3 + ...) 1 by adding up the terms in turn until the sum doesn't change anymore Examples: = 0 = mylog(1) mylog(0.36787) mylog(0.13533) N [log(1) [log(1/e) [log(1/(e*e)). -1 -2 = 0] -1] -2] N = In function main() provide code to test your function. You can't use functions from math.h
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
