if Int(x) = x then ceiling = x else ceiling = Int(x) + 1
"greengiant83" wrote:
Most languages have a ceiling function. ... Does Brightscript not have this basic method?
"damon1337" wrote:
There is: just use Int(variable as float)
BrightScript Debugger> ? int(1.4), int(-1.4)
1 -2
function ceiling(x):
i = int(x)
if i < x then i = i + 1
return i
end function
BrightScript Debugger> ceiling = function(x): return int(x) + sgn(x - int(x)): end function
BrightScript Debugger> ? ceiling(1.4), ceiling(-1.4)
2 -1