Compute Pi in javascript