On Wikipedia I found a page about Pi and how to calculate this.
So i converted the C code on Wikipedia for calculating Pi in AutoIt code and here it is!
The first one is just a script which calculates Pi until you are 80 years or something.
The second is a UDF.
The script:
$a = 0 $b = 0 $c = 0 $start = TimerInit() While 1 $a += 1 $b += 1 $c += 1/($a*$a) If $b = 100000 Then $b = 0 ConsoleWrite(Sqrt($c*6)) ConsoleWrite(@CRLF) ConsoleWrite(" " & Round(TimerDiff($start)) / 1000 & " seconds") ConsoleWrite(@CRLF) $start = TimerInit() EndIf WEnd
Feedback is welcome
EDIT: Busti optimized the loop in the UDF
Edited by Pakku, 16 November 2010 - 12:31 AM.







