Calculate π with your browser! - by Don Cross

This page uses JavaScript to calculate π to very high accuracy. You must enable JavaScript in your browser for this page to work.

Depending on your browser and your computer's processing speed, choosing a large number of digits may cause a warning that the script on this page is executing too long. Allow the browser to continue executing the script and eventually it will finish.

Number of digits:

How it works

I am writing a high-precision math library for JavaScript, called BigMath.js. This page is a test of that library using the formula:

π = 48*arctan(1/18) + 32*arctan(1/57) − 20*arctan(1/239)

See also:

If you liked this page, you might also like my high-precision nth root calculator page.

The same π calculation algorithm, only in the form of a Windows batch file, was featured as a Stupid Coding Trick by The Daily WTF.