Concurrent Pi = 3.14157?


(Jim Julian) #1

Hello,

Just visited the GO homepage for the first time. I saw the operational examples list and tried a couple of them.
I tried the “Concurrent Pi” example and the result was Pi = 3.1417926135957934
Pi is 3.14159265358979323. Did I miss something?
I am new to the GO programming language and know only what I’ve learned from the video on the webpage.

Thank you,
Jim Julian


(Dave Cheney) #2

The sample code is an approximation of pi, I imaging if you increase the number of iterations (hence goroutines) to 10,000 or 20,000 the result would converge closer to the real value of pi.


(system) #3

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.