floor: 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: result = floor(num)]
[h: result = floor(num)]
</syntaxhighlight>
</syntaxhighlight>


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


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


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

Latest revision as of 23:59, 14 March 2023

floor() Function

Returns the number padded in if it is an integer, otherwise the number is rounded down to the nearest smaller integer and that value is returned.

Usage

[h: result = floor(num)]

Examples

[r: floor(2)]

Returns 2.

[r: floor(1.2)]

Returns 1.

[r: floor(-1.2)]
Returns -2.