Qbasicnews.com

Full Version: ah, pi.
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I made my pi formula at http://www.geocities.com/pisforpi/ into a program.

CLS
n% = 21
IF n% = 0 THEN SYSTEM
j# = 0
FOR I% = 1 TO n% - 1
j# = (2 + j#) ^ .5
NEXT I%
j# = (2 - j#) ^ .5 * 2 ^ n%
PRINT j#
Wrong.

Pi is:
3.1415926535897932384626433832...

All of that from my memory Tongue

::EDIT::
pi# = 4 * ATAN(1)
Rounding error. Try n = 16.
hmm here's a way i just thought of

Pi# = COS(2) * -7.5492358222#
Print Pi#

altho it's slightly inaccurate, but heh it's original Tongue