The Soda Pop
/ /

XtScript Function: ceil and floor

Round fractions up, or down.

ceil is an XtScript function that will round a floating number up.

On the other hand, floor is an XtScript function that will round a floating number down.

XtScript ceil and floor function basic syntax:

<!--parser:xtscript-->
	# Round floating number up
	call ceil $num=...

	# Round floating number down
	call floor $num=...
<!--/parser:xtscript-->

Learn XtScript ceil and floor function from examples

Round floating number up or down using XtScript ceil or floor function.

- Code:
<!--parser:xtscript-->
	var $number = 23.1412
	var $rounded_up = call ceil $num=$number
	var $rounded_down = call floor $num=$number

	print Number: $number <br/>
	print Rounded up: $rounded_up <br/>
	print Rounded down: $rounded_down
<!--/parser:xtscript-->
- Result:
Number: 23.1412
Rounded up: 24
Rounded down: 23