Difference between revisions of "NXSL:round"
Jump to navigation
Jump to search
(Created page with "__NOTOC__ Round floating point value to the nearest integral value or floating point value with given precision. == Syntax == round(''x'', ''precision''); == Parameters =...") |
m (Text replacement - "^" to "{{deprecated}}") |
||
(4 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
__NOTOC__ | {{deprecated}}__NOTOC__ | ||
Round floating point value to the nearest integral value or floating point value with given precision. | Round floating point value to the nearest integral value or floating point value with given precision. | ||
'''Since:''' 1.2.5 | |||
== Syntax == | == Syntax == | ||
round(''x'', ''precision''); | round(''x'' [, ''precision'']); | ||
== Parameters == | == Parameters == | ||
:{| | :{| class="wikitable" | ||
|- | |- | ||
| ''x'' || Floating point value. | | ''x'' || Floating point value. |
Latest revision as of 18:13, 13 September 2022
This Wiki is deprecated and we are are currrently migrating remaining pages into product documentation (Admin Guide, NXSL Guide) |
Round floating point value to the nearest integral value or floating point value with given precision.
Since: 1.2.5
Syntax
round(x [, precision]);
Parameters
x Floating point value. precision optional number of decimal places to be left. If omited or set to 0, x will be rounded to integral value.
Return Value
The integral value that is closest to x if precision is omited or set to 0, or floating point value rounded to have given number of decimal places.
Examples
round(2.3) -> 2 round(3.8) -> 4 round(-2.3) -> -2 round(-3.8) -> -4 round(2.378, 2) -> 2.38 round(2.378, 1) -> 2.4