diff --git a/src/exponent.c b/src/exponent.c index 2cfecf5..b37deab 100644 --- a/src/exponent.c +++ b/src/exponent.c @@ -46,4 +46,24 @@ double exponential(double x){ sum += (1.0/fac(i)*(expIN(i,x))); } return sum; +} + +double absD(double x){ + if(x<0){ + return -1 * x; + } + return x; +} + +double logN(double x, double eps){ + double yn = x - 1.0; + double yn1 = yn; + + do + { + yn = yn1; + yn1 = yn + 2 * (x - exponential(yn)) / (x + exponential(yn)); + } while (absD(yn - yn1) > eps); + + return yn1; } \ No newline at end of file