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
// Define a method that rounds pi to a specified decimal place | |
// Return Pi and how many iterations of the following formula that it took to accomplish | |
// pi = 4 * (1 – 1/3 + 1/5 – 1/7 + ...) | |
function* pi() { | |
let n = 1; | |
let series = 0; | |
while(true) { | |
next = 1/(n*2-1) |