round: Difference between revisions

From RPTools Wiki
Jump to navigation Jump to search
(New page: {{MacroFunction |name=round |description=Returns the rounded value of a number to specified precision (number of digits after the decimal point). precision can be zero (default)...)
 
No edit summary
Line 15: Line 15:


<source lang="mtmacro" line>
<source lang="mtmacro" line>
[r: floor(1.45, 1)]
[r: round(1.45, 1)]
</source>
</source>
Returns 1.5
Returns 1.5


<source lang="mtmacro" line>
<source lang="mtmacro" line>
[r: floor(1.44,1)]
[r: round(1.44,1)]
</source>
</source>
Returns 1.4
Returns 1.4
}}
}}
[[Category:Mathematical Function]]
[[Category:Mathematical Function]]

Revision as of 23:47, 24 February 2010

round() Function

Returns the rounded value of a number to specified precision (number of digits after the decimal point). precision can be zero (default).

Usage

[h: result = round(number, precision)]

Examples

[r: round(1.45)]

Returns 1

[r: round(1.45, 1)]

Returns 1.5

[r: round(1.44,1)]
Returns 1.4