ceiling: Difference between revisions

From RPTools Wiki
Jump to navigation Jump to search
m (Conversion script moved page Ceiling to ceiling: Converting page titles to lowercase)
m (Text replacement - "<source" to "<syntaxhighlight")
 
(2 intermediate revisions 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)]
</source>
</syntaxhighlight>


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


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


<source lang="mtmacro" line>
<syntaxhighlight lang="mtmacro" line>
[r: ceil(-1.2)]
[r: ceil(-1.2)]
</source>
</syntaxhighlight>
Returns -1.
Returns -1.
}}
}}
[[Category:Mathematical Function]]
[[Category:Mathematical Function]]

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.