# Calculating Pi using JavaScript

During my time calculating Pi using PHP ( http://coderwall.com/p/g35wya?i=1&p=1&q= ), I decided it was time to try it with JavaScript.

Here is the jsFiddle: http://jsfiddle.net/WfpzT/4/

This script will allow you to enter an **accuracy** number and then calculate Pi using that number of iterations. The higher the accuracy, the more accurate your Pi calculations will be.

*More information about this method of calculating Pi can be found here: http://en.wikipedia.org/wiki/Leibniz_formula_for_%CF%80*

#### Written by Daniel Pepin

#### Related protips

#### Have a fresh tip? Share with Coderwall community!

Post

Post a tip

Best
#Math
Authors

Sponsored by #native_company# — Learn More

#native_title#
#native_desc#