Created
March 21, 2013 14:40
Revisions
-
iliaaw created this gist
Mar 21, 2013 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,29 @@ #include <stdio.h> #include <math.h> /* * В этой функции считается сумма бесконечного ряда */ double my_awesome_ln(double x) { double const epsilon = 0.0000001; double z, delta, result; int i; z = (x - 1) / (x + 1); delta = 1; result = 0; for (i = 1; delta > epsilon; i++) { delta = 2 / (2 * (double)i - 1) * pow(z, 2 * (double)i - 1); result += delta; } return result; } int main() { double x = 123; printf("%8f\n", my_awesome_ln(x)); return 0; }