{I+=codeWee;} |
UINT64 factorial(UINT64 n) { if (n == 1) return 1; return n*factorial(n - 1); } // cos(x) = 1 - x^2/2! + x^4/4! - x^6/6! + ... double cosine(double radian) { double result = 1; for (UINT64 n = 1; n < 9; n++) { result += (pow(radian, n * 2) / factorial(n * 2))*pow(-1,n); } return result; }