floor: Difference between revisions

From RPTools Wiki
Jump to navigation Jump to search
m (Conversion script moved page Floor to floor: Converting page titles to lowercase)
m (Text replacement - "source>" to "syntaxhighlight>")
Line 6: Line 6:
<source lang="mtmacro" line>
<source lang="mtmacro" line>
[h: result = floor(num)]
[h: result = floor(num)]
</source>
</syntaxhighlight>


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


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


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

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

<source lang="mtmacro" line> [h: result = floor(num)] </syntaxhighlight>

Examples

<source lang="mtmacro" line>

[r: floor(2)] </syntaxhighlight> Returns 2.

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

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

Returns -2.