2
0
mirror of https://github.com/koreader/koreader synced 2024-11-11 19:11:14 +00:00
koreader/frontend/math.lua

26 lines
321 B
Lua
Raw Normal View History

--[[
Simple math helper function
]]--
function math.roundAwayFromZero(num)
if num > 0 then
return math.ceil(num)
else
return math.floor(num)
end
end
function math.round(num)
return math.floor(num + 0.5)
end
function math.oddEven(number)
if number % 2 == 1 then
return "odd"
else
return "even"
end
end