I have found a series that can calculate PI to a great deal of accuracy with less terms.
I'll do that using JavaScript.

## Step 1: See the Formula We Use

The day was boring and I so to cut of the boredom, I searched for some formula to calculate PI. Then I found this formula and used it in the JavaScript. Just take a look at the formula:

## Step 2: Translating the Formula to JavaScript

Then I used a while loop ( for-loop would have been better, but I forgot that) to use the formula up to accuracy you want. I have the formula:
3 + 4 / ( 2 * 3 * 4) + 4 / (4 * 5 * 6) + .....
The numbers at the denominator increases by 2 and we have used x+1 is 3 and x+2 is 4. SO we get 3 + 4/(2*(2+1)*(2+2))+.....
We use x instead of  2 because we need to add 2 to all of them every time. And now look.
Just use it if you want.

<!DOCTYPE html>
<html>
<script src="latextit.js"></script>
<script type="text/javascript">
$(document).ready(function(){$('#button').click(function(){
var value = $('input[name=accuracyPercent]').val(); if(parseInt(value) < 2 ){ alert("It should be more than " + parseInt(value) + " "); }else if(parseInt(value) > 80 ){ alert("It should be less than " + parseInt(value) + " "); }else{ //first lower var x = 2; // the variable to collect the estimation of pi var n = 3; //initial term var i = 2; var accuracy = parseInt(value) * 2000;//while loop while(i <= accuracy){ //if the i is even, then do this if(i % 2 === 0){ // the formula n += (4 / ( x * ( x + 1) * ( x + 2))); }else{ // else you do this // the formula n -= (4 / ( x * ( x + 1) * ( x + 2))); } // add 2 to x x += 2; // i i++; }$('#item').replaceWith('<div id = "item">' + n + '</div>');
}
});
$('#button').mouseover(function(){$(this).css('color', '#fff');
});
$('#button').mouseleave(function(){$(this).css('color', '#000')
});
});
</script>
<style type="text/css">
body{
background: -webkit-linear-gradient(-45deg, #0ff, blue); /* For Safari */
background: -o-linear-gradient(-45deg, #0ff, blue); /* For Opera 11.1 to 12.0 */
background: -moz-linear-gradient(-45deg, #0ff, blue); /* For Firefox 3.6 to 15 */
background: linear-gradient(-45deg, #0ff, blue); /* Standard syntax */
}
form{
display: inline-block;
background-color: blue;
}
#button{
display: inline-block;
height:20px;
width:70px;
background-color:#cc0000;
font-family:arial;
font-weight:bold;
color:#000;
text-align:center;
margin-top:2px;
}
#item{
text-align: center;
font-size: 40px;
color: #000;
}
.list{
font-size: 20px;
}
</style>
<body>
<form name="accuracyPercent">
<input type="text" name="accuracyPercent"/>
</form>
<div id="button">Get!</div>
<p class = "list">
Let us find the value of <span lang="latex">$\pi$</span> to your accuracy point. (Remember, your value should be greater than 2, less than 1000 and an integer):
</p>
<div id = "item">
3.14159 26535 89793 23846
</div>
</body>
</html>
<p>YES, it works! Thanks for sharing.</p><p>I did an easy KEX macro (I love <a rel="nofollow">Kedit</a>) and it brings correct values. The convergence is a bit slow, but it works well.</p><p style="margin-left: 20.0px;">* 13/02/14 00:03 Calcula pi seg&uacute;n una f&oacute;rmula que baj&eacute; de un instructable de ruhanhabib39<br>* pi = 3 + 4/2x3x4 - 4/4x5x6 + 4/6x7x8 - 4/8x9x10 + ...<br>* pi = 3,1415926535897932384626433832795 seg&uacute;n Cal.exe de Microsoft.<br>numeric digits 31;<br>pi = 3;<br>piant = 3;<br>signo = 1;<br>lf = d2c(10);<br>MSpi = 3.1415926535897932384626433832795;<br>do ii=1 to 9999 by 2;<br> jj=ii+1; <br> kk=ii+2;<br> ll=ii+3;<br> pi = pi + signo * 4 / (jj * kk * ll);<br> 'dialog}MSpi = 'MSpi lf'pi val&iacute;a 'piant lf'y ahora vale ' pi'}okcancel';<br> if dialog.2 = &quot;CANCEL&quot; then exit;<br> signo = 0 - signo;<br> piant = pi;<br>end;</p>