Skip to content

Instantly share code, notes, and snippets.

@benrob0329
Created December 12, 2017 01:47
Show Gist options
  • Save benrob0329/fa720f235833bd498db4784da6d1ba9e to your computer and use it in GitHub Desktop.
Save benrob0329/fa720f235833bd498db4784da6d1ba9e to your computer and use it in GitHub Desktop.
local calpi = function()
local operator = '+'
local mypi = 0
for i=1, 1000000000, 2 do
if operator == '+' then
mypi = mypi + (4/i)
operator = '-'
elseif operator == '-' then
mypi = mypi - (4/i)
operator = '+'
end
end
print(mypi)
end
calpi()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment