Web Worker: The Run After Π

pi in xkcd eyes

The Calaulated Π

Try to play with cycles from 1 to 1M and see what you get...
This is the function that run in the web worker thread

function calculatePi(cycles) {
  var pi = 0;
  var n  = 1;
  for (var i=0; i <= cycles; i++) {
    pi = pi + (4/n) - (4 / (n+2));
    n  = n  + 4;
  }
  return pi;
}