Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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