Skip to content

Instantly share code, notes, and snippets.

@SakiiR
Created November 1, 2017 15:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SakiiR/b2280c0edca934e43aed3678513ba3aa to your computer and use it in GitHub Desktop.
Save SakiiR/b2280c0edca934e43aed3678513ba3aa to your computer and use it in GitHub Desktop.
C++ Power
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