====== advtrains.abs_ceil ======
//Rounds a number away from zero.//
//Notes://
* //this page has been written for Advtrains 2.0.1 TSS and Minetest 5.1.0. Examples and practices described in this page don't take advantage of improvements introduced in later releases.//
* //''math.sign'' is not available in all Lua versions. See this [[https://stackoverflow.com/questions/1318220/lua-decimal-sign|Stack Overflow question]] for more details.//
===== Syntax =====
advtrains.abs_ceil(i)
===== Parameters =====
* ''i'' //(number)//: a number.
===== Returns =====
The specified argument rounded away from zero.
===== Examples =====
advtrains.abs_ceil(3) -- 3
advtrains.abs_ceil(3.1) -- 4
advtrains.abs_ceil(3.5) -- 4
advtrains.abs_ceil(3.9) -- 4
advtrains.abs_ceil(-3) -- -3
advtrains.abs_ceil(-3.1) -- -4
advtrains.abs_ceil(-0.00001) -- -1
advtrains.abs_ceil( 0.00001) -- 1
===== In source code =====
advtrains/helpers.lua, lines 186 to 188:
function advtrains.abs_ceil(i)
return math.ceil(math.abs(i))*math.sign(i)
end