Difference between revisions of "NXSL:round"
		
		
		
		
		
		Jump to navigation
		Jump to search
		
				
		
		
	
| Line 2: | Line 2: | ||
| 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 == | ||
Revision as of 00:19, 6 January 2013
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