I want to know how to write logarithm in C++

The following series summation is an approximation for computing the natural logarithm of a floating-point value x:
Log x=(x-1)-(x-1) 2 /2+(x-1) 3/3-(x-4) 4/4+…+ (-i) n+1(x-1) n/n
Where 2>= X>0 and n is a positive integer. Please design an interactive program that does the following:
a. Prompts the user to enter a floating-point value for x and reads it.
b. Ensure that x is in the proper range; if not, reprompts the user to enter another values.
c. Computes the natural logarithm of x using the standard library function log(x) and prints it.
d. Computes the natural logarithm of x using the preceding approximation and prints it. P/s do your computations in a loop and terminate the loop if the absolute value of the last term computed in the series is less than 0.00001

http://www.cplusplus.com/forum/articles/1295/

You could at least do some of this yourself...
Last edited on
Topic archived. No new replies allowed.