wiseguyusa Posted May 29, 2015 Share Posted May 29, 2015 The topic I started about calculating Pi seems to have expired (but the one that pissed off all of the homebrew programmers still there LOL) In short, I wrote a very primitive BASIC program that divided 22 by 7 and then generated random numbers after it had finished carrying that out to appear as if it was calculating Pi indefinately. I gambled that no-one would scrutinize the math and the gamble paid off I got an "A+" for an "Outstanding" science fair project. My C-64 fanboy programmer pal sent me this and says a C-64 CAN do it. What say you Atari Agers: Is this real? Can a similar program be written in Atari BASIC? // Concurrent computation of pi.//>> Dead link removed<<//// This demonstrates Go's ability to handle// large numbers of concurrent processes.// It is an unreasonable way to calculate pi.package mainimport ( "fmt" "math")func main() { fmt.Println(pi(5000))}// pi launches n goroutines to compute an// approximation of pi.func pi(n int) float64 { ch := make(chan float64) for k := 0; k <= n; k++ { go term(ch, float64(k)) } f := 0.0 for k := 0; k <= n; k++ { f += <-ch } return f}func term(ch chan float64, k float64) { ch <- 4 * math.Pow(-1, k) / (2*k + 1)} Quote Link to comment Share on other sites More sharing options...
+5-11under Posted May 29, 2015 Share Posted May 29, 2015 Maybe it's method 2 from here: http://www.wikihow.com/Calculate-Pi Quote Link to comment Share on other sites More sharing options...
devwebcl Posted December 15, 2015 Share Posted December 15, 2015 Here it is your original post: http://atariage.com/forums/topic/220343-i-cheated-in-middle-school/page-2?hl=%2Bpi&do=findComment&comment=2921769 Quote Link to comment Share on other sites More sharing options...
fujidude Posted December 15, 2015 Share Posted December 15, 2015 Crap. I jumped in here thinking it would be something about the Raspberry Pi. Quote Link to comment Share on other sites More sharing options...
Rybags Posted December 15, 2015 Share Posted December 15, 2015 (edited) Just get the C64 executable and it'll likely be easy to convert especially if it's not using any OS or Rom functions. A potential problem area though is if it requires a contiguous work area, on C64 you can switch the IO area out so giving a 65534 byte contiguous Ram area. On Atari we can only get 52K contiguous and that's regardless of amount of installed Ram (exception there can be 65816 systems using expanded addressing). Alternatively though a 130XE or better banked Ram situation could allow for a more complex calculation though come with potentially high speed penalties as switching banks can slow some processes right down. Edited December 15, 2015 by Rybags 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.