Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

/PROG/ Challenge Number 3 - Pi

Name: Anonymous 2007-09-13 22:45 ID:IZip/Yni

Make a program to calculate pi to the n'th decimal. Input the variable at runtime.  Program In the language of you choice. (and none of the print"3.1415" crap.)

Name: Anonymous 2007-09-14 22:14 ID:pmk4hbO8

Protip: Use Manchin's formula:
pi = 4*(4*arctan(1/5) - arctan(1/239))

If you want it more precise:
pi = 4*(183*atan(1/239)+32*atan(1/1023)-68*atan(1/5382)+12*atan(1/113021)-100*atan(1/6826318)-12*atan(1/33366019650)+12*atan(1/43599522992503626068))

Use modulus division to get the digit you want. Trivial.

But, let's get serious... pi to 30 digits is enough to compute the visible universe with almost no error. For most cases, you don't need lots of digits. It's a parlor trick.

Next?

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List