erifash Posted January 19, 2006 Author Posted January 19, 2006 Yes the output is correct. I don't have time to look at the code right now though... My UDFs:_FilePrint() | _ProcessGetName() | _Degree() and _Radian()My Scripts:Drive Lock - Computer Lock Using a Flash DriveAU3Chat - Simple Multiuser TCP ChatroomStringChunk - Split a String Into Equal PartsAutoProxy - Custom Webserver
w0uter Posted January 19, 2006 Posted January 19, 2006 (edited) 500 didgits in under 109 seconds nice larry. Edited January 19, 2006 by w0uter My UDF's:;mem stuff_Mem;ftp stuff_FTP ( OLD );inet stuff_INetGetSource ( OLD )_INetGetImage _INetBrowse ( Collection )_EncodeUrl_NetStat_Google;random stuff_iPixelSearch_DiceRoll
herewasplato Posted January 19, 2006 Posted January 19, 2006 Yes the output is correct...141592653589793238462643383279 - Ruby* 141592653589793238462643383279 - AutoIt (Larry) 502884197169399375105820974944 502884197169399375105820974944 592307816406286208998628034825 592307816406286208999184097971 [*Ruby output as claimed by http://www.cs.utsa.edu/~wagner/pi/pi10000dig.html] I'm not sure which is correct... "I'm just sayin'." Paul Reiser (aka. Paul Buchman) [size="1"][font="Arial"].[u].[/u][/font][/size]
erifash Posted January 20, 2006 Author Posted January 20, 2006 That is one nice piece of code. It is accurate too (the 40 digits I know at least). At my school we have Pi Day where people from each class compete by memorizing as many digits of pi as they can. Our school record is 230 something digits. My UDFs:_FilePrint() | _ProcessGetName() | _Degree() and _Radian()My Scripts:Drive Lock - Computer Lock Using a Flash DriveAU3Chat - Simple Multiuser TCP ChatroomStringChunk - Split a String Into Equal PartsAutoProxy - Custom Webserver
MSLx Fanboy Posted January 20, 2006 Posted January 20, 2006 Very nice Larry. Ran it, and I have it accurate to 715 decimal places (input of 720, about 45 seconds) Writing AutoIt scripts since _DateAdd("d", -2, _NowCalcDate())
theguy0000 Posted January 20, 2006 Posted January 20, 2006 (edited) $PI = 22 / 7 MsgBox(0,"",$PI)Tru Pi is not 22 / 7, despite what some places might say Pi is an irrational decimal, meaning it is absolutely impossible to represent it as a fraction. Matt Edited January 20, 2006 by theguy0000 The cake is a lie.www.theguy0000.com is currentlyUP images.theguy0000.com is currentlyUP all other *.theguy0000.com sites are DOWN
seandisanti Posted January 20, 2006 Posted January 20, 2006 Tru Pi is not 22 / 7, despite what some places might say Pi is an irrational decimal, meaning it is absolutely impossible to represent it as a fraction. Matt except for C/D right?
herewasplato Posted January 20, 2006 Posted January 20, 2006 (edited) port of some old basic code...That code's output (from post #27) and Ruby's output differ at the 10005th digit.In case anyone cares..... Edited January 20, 2006 by herewasplato [size="1"][font="Arial"].[u].[/u][/font][/size]
seandisanti Posted January 20, 2006 Posted January 20, 2006 That code's output (from post #27) and Ruby's output differ at the 10005th digit.In case anyone cares.....nice. so which is correct?
herewasplato Posted January 21, 2006 Posted January 21, 2006 nice. so which is correct?...like I'd know. :-)...but one could ask David B. http://crd.lbl.gov/~dhbailey/pi/index.html(Anyone up for the conversion of the Fortran-90 or C programs there?)...or dig around in here http://oldweb.cecm.sfu.ca/projects/pihex/Interesting graphs: http://oldweb.cecm.sfu.ca/projects/pihex/status.htmlOR is it all just a cruel joke on mankind? [size="1"][font="Arial"].[u].[/u][/font][/size]
seandisanti Posted January 22, 2006 Posted January 22, 2006 ...like I'd know. :-)...but one could ask David B. http://crd.lbl.gov/~dhbailey/pi/index.html(Anyone up for the conversion of the Fortran-90 or C programs there?)...or dig around in here http://oldweb.cecm.sfu.ca/projects/pihex/Interesting graphs: http://oldweb.cecm.sfu.ca/projects/pihex/status.htmlOR is it all just a cruel joke on mankind?6 billion digits arleady calculated. nice.
Nakuribon Posted January 23, 2006 Posted January 23, 2006 hi, in case anyone doesnt know, i'm kevin, and i found my old rewritten script for pi, turns out it wasnt in autoit, but ti-89 basic lol, so i converted it, and it worked! however, it got really screwy with the output, take a look: script: expandcollapse popup$n = 0 $pi ="" $pistr = "" $k = 2 $a = 4 $b = 1 $a1 = 12 $b1 = 4 While 1 $p = $k * $k $q = 2 * $k + 1 $k = $k + 1 $aold = $a1 $bold = $b1 $a1 = $p * $a + $q * $a1 $b1 = $p * $b + $q * $b1 $a = $aold $b = $bold $d = Int($a / $b) $d1 = Int($a1 / $b1) While $d == $d1 $n += 1 If $n == 2 Then $pi &= "." & String($d) Else $pi &= String($d) EndIf $pistr &= $pi $pi = "" $a = 10 * Mod($a, $b) $a1 = 10 * Mod($a1, $b1) $d = Int($a / $b) $d1 = Int($a1 / $b1) WEnd WEnd Func OnAutoItExit() FileWrite("pi.txt", $pistr) EndFunc output: 3.141592653-9223372036854775808-92233720368547758089223372036854775807-9223372036854775808-9223372036854775808-9223372036854775808922337203685477580792233720368547758079223372036854775807922337203685477580792233 72036854775807-9223372036854775808-92233720368547758089223372036854775807-9223372036854775808-922337203685477580892233720368547758079223372036854775807-92233720368547758080000000000000000000... go figure... i wanna kno whats up with the negatives, im wondering if its something to do with some bad binary conversions on the C side of autoit. cya! i own this sig... php rulezlinks:My PSP Web Portal
theguy0000 Posted January 23, 2006 Posted January 23, 2006 (edited) notice that every "-" is followed by 9. hmm. I wish i understood the code in the first place. could someone point me to the exact code that is being used here? Edited January 23, 2006 by theguy0000 The cake is a lie.www.theguy0000.com is currentlyUP images.theguy0000.com is currentlyUP all other *.theguy0000.com sites are DOWN
herewasplato Posted January 23, 2006 Posted January 23, 2006 (edited) Change your code and see if you see the problem:$pistr &= $piMsgBox(0,"pi",$pistr)$pi = ""$a = 10 * Mod($a, $MsgBox(0,"$a",$a)$a1 = 10 * Mod($a1, $b1)MsgBox(0,"$a1",$a1)Edit: this is about like the code posted earlier in this thread:http://www.autoitscript.com/forum/index.ph...ndpost&p=140881I added the boxes to that code and saw the same thing - not that I know what to do about it - just noticed it..... Edited January 23, 2006 by herewasplato [size="1"][font="Arial"].[u].[/u][/font][/size]
theguy0000 Posted January 23, 2006 Posted January 23, 2006 whoa. confusing. there must be a logical explanation for the "-"s, and why they are always followed by a 9. but i dont know it The cake is a lie.www.theguy0000.com is currentlyUP images.theguy0000.com is currentlyUP all other *.theguy0000.com sites are DOWN
Valik Posted January 23, 2006 Posted January 23, 2006 You're overflowing something in the second while loop. You're either overflowing a double or an int somewhere in that code. Once you do that, you basically blow the whole algorithm up. You have to write code that calculates pi without overflowing the limits of a double or 32-bit integer (Maybe 64-bit, I'm a bit fuzzy on how AutoIt determines 32/64 bit ints). The algorithm is at fault, though, I can tell that much by looking at some variable traces while it runs.
erifash Posted January 26, 2006 Author Posted January 26, 2006 (edited) You're overflowing something in the second while loop. You're either overflowing a double or an int somewhere in that code. Once you do that, you basically blow the whole algorithm up. You have to write code that calculates pi without overflowing the limits of a double or 32-bit integer (Maybe 64-bit, I'm a bit fuzzy on how AutoIt determines 32/64 bit ints).The algorithm is at fault, though, I can tell that much by looking at some variable traces while it runs.BTW - In hexadecimal the two "overflow numbers" (-9223372036854775808 and 9223372036854775807) that I see are 0x8000000000000000 and 0x7FFFFFFFFFFFFFFF respectively. The latter being the number limit of AutoIt. I converted them using calc.exe.EDIT: I was debugging Kevin's code and it turns out that the variables $a and $a1 are overflowing. Edited January 26, 2006 by erifash My UDFs:_FilePrint() | _ProcessGetName() | _Degree() and _Radian()My Scripts:Drive Lock - Computer Lock Using a Flash DriveAU3Chat - Simple Multiuser TCP ChatroomStringChunk - Split a String Into Equal PartsAutoProxy - Custom Webserver
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now