This is what I currently have and it doesn’t really accept float values.
function maths.fact(n)
if not n or math.floor(n) ~= n then warn("invalid input.") return end
local f = 1
for i = 1, n do
f *= i
end
print(f)
end
This is what I currently have and it doesn’t really accept float values.
function maths.fact(n)
if not n or math.floor(n) ~= n then warn("invalid input.") return end
local f = 1
for i = 1, n do
f *= i
end
print(f)
end
If you want to take the factorial of a floating point you have to use the gamma function. Might be non trivial to implement and not worth it unless you have a convincing use case