lamb/std/math.lamb
2014-02-11 04:55:40 -08:00

9 lines
No EOL
279 B
Text

-- Standard math library for the Lamb programming language
-- Copyright (c) 2013 darkf
-- Licensed under the terms of the zlib license, see LICENSE for details
pow(base, 0) -> 1.
pow(base, exp) -> do
if exp < 0 then 1 / pow(base, neg(exp))
else base * pow(base, exp-1)
end.