Created
November 1, 2017 15:49
-
-
Save SakiiR/b2280c0edca934e43aed3678513ba3aa to your computer and use it in GitHub Desktop.
C++ Power
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 characters
double powerx(1.0); | |
for (int i(0); i <= N; ++i) // ON VA SEPARER LA SOMME EN DEUX PUISQUE CELLE CI CONVERGE | |
{ | |
if (i%2 != 0) { | |
cos_x -= powerx / factorielle(2*i); [URL]//SI[/URL] I EST IMPAIR ON SOUSTRAIT | |
} | |
else { | |
cos_x += powerx / factorielle(2*i); // SI I EST PAIR ON ADDITIONNE | |
} | |
powerx *= x*x; [URL]//ON[/URL] AUGMENTE LA PUISSANCE DE X A CHAQUE ITERATION | |
} | |
return cos_x; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment