Table of Contents

advtrains.abs_ceil

Rounds a number away from zero.

Notes:

Syntax

advtrains.abs_ceil(i)

Parameters

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:

abs_ceil.lua
function advtrains.abs_ceil(i)
    return math.ceil(math.abs(i))*math.sign(i)
end