ceiling: Difference between revisions

From RPTools Wiki
Jump to navigation Jump to search
m (Text replacement - "source>" to "syntaxhighlight>")
m (Text replacement - "<source" to "<syntaxhighlight")
 
(One intermediate revision by the same user not shown)
Line 4: Line 4:


|usage=
|usage=
<source lang="mtmacro" line>
<syntaxhighlight lang="mtmacro" line>
[h: val = ceil(num)]
[h: val = ceil(num)]
[h: val = ceiling(num)]
[h: val = ceiling(num)]
Line 10: Line 10:


|examples=
|examples=
<source lang="mtmacro" line>
<syntaxhighlight lang="mtmacro" line>
[r: ceil(10)]
[r: ceil(10)]
</syntaxhighlight>
</syntaxhighlight>
Returns 10.
Returns 10.


<source lang="mtmacro" line>
<syntaxhighlight lang="mtmacro" line>
[r: ceil(1.2)]
[r: ceil(1.2)]
</syntaxhighlight>
</syntaxhighlight>
Returns 2.
Returns 2.


<source lang="mtmacro" line>
<syntaxhighlight lang="mtmacro" line>
[r: ceil(-1.2)]
[r: ceil(-1.2)]
</syntaxhighlight>
</syntaxhighlight>

Latest revision as of 23:59, 14 March 2023

ceiling() Function

Returns the number passed in if it is an integer, otherwise it returns the number rounded up to the next integer.

Usage

[h: val = ceil(num)]
[h: val = ceiling(num)]

Examples

[r: ceil(10)]

Returns 10.

[r: ceil(1.2)]

Returns 2.

[r: ceil(-1.2)]
Returns -1.