Add comment about which method is used to approximate pi
This commit is contained in:
parent
f98e46dbe4
commit
ed40922f52
1 changed files with 1 additions and 0 deletions
|
@ -6,6 +6,7 @@ double approximate_pi(unsigned int steps) {
|
||||||
double approximate_pi = 4.0;
|
double approximate_pi = 4.0;
|
||||||
bool subtract = true;
|
bool subtract = true;
|
||||||
|
|
||||||
|
/* Gregory–Leibniz series */
|
||||||
for (unsigned int i = 2; i <= steps; i++) {
|
for (unsigned int i = 2; i <= steps; i++) {
|
||||||
if (subtract) {
|
if (subtract) {
|
||||||
approximate_pi -= (4.0 / (i * 2 - 1));
|
approximate_pi -= (4.0 / (i * 2 - 1));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue