replaced facttest.lua with fibtest.lua

Optimized the NaN box to be byte aligned, performance under the fibtest.lua script improved by ~2.5 seconds (~31 before ~28.5 after on cpunch's machine)
also cleaned up some misc. comments
This commit is contained in:
2020-12-07 23:26:55 -06:00
parent f8a062919f
commit 9aa7fa1381
5 changed files with 27 additions and 33 deletions

11
examples/fibtest.lua Normal file
View File

@@ -0,0 +1,11 @@
local function fib(num)
if num <= 1 then
return num
else
return fib(num-2) + fib(num-1)
end
end
for (var i = 1; i < 40; i++) do
print("The fib number of " .. i .. " is " .. fib(i))
end

View File

@@ -1,13 +0,0 @@
local function fact(num)
var total = 1
for (var i = num; i > 0; i = i - 1) do
total = total * i
end
return total
end
for (var x = 0; x < 1000; x=x+1) do
for (var z = 0; z < 100; z=z+1) do
print("The factorial of " .. x .. "." .. z .. " is " .. fact(z))
end
end