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>")
Line 7: Line 7:
[h: val = ceil(num)]
[h: val = ceil(num)]
[h: val = ceiling(num)]
[h: val = ceiling(num)]
</source>
</syntaxhighlight>


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


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


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

Revision as of 17:10, 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

<source lang="mtmacro" line> [h: val = ceil(num)] [h: val = ceiling(num)] </syntaxhighlight>

Examples

<source lang="mtmacro" line>

[r: ceil(10)] </syntaxhighlight> Returns 10.

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

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

Returns -1.