floor: Difference between revisions

From RPTools Wiki
Jump to navigation Jump to search
(New page: ==Function deleteStrProp== 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=== <s...)
 
m (Text replacement - "<source" to "<syntaxhighlight")
 
(6 intermediate revisions by 4 users not shown)
Line 1: Line 1:
==Function deleteStrProp==
{{MacroFunction
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.
|name=floor
|description=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===
|usage=
<source lang="mtmacro" line>
<syntaxhighlight lang="mtmacro" line>
[h: result = floor(num)]
[h: result = floor(num)]
</source>
</syntaxhighlight>


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


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


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

Latest revision as of 18:31, 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.