round
This function is used by Ignition's Expression language.
Description​
Rounds a floating point number. If the decimals argument is omitted, then the number is rounded to the nearest integer value, and the result will be a long (64-bit integer). If a number of decimal places are specified, the result will be a double (64-bit floating point value), and the result will be rounded to the given number of decimal places.
Syntax​
round(number, [decimals])
Parameters​
Type | Parameter | Description |
---|---|---|
Float | number | The number to round. |
Integer | decimals | The number of decimal places to round to. Defaults to 0. [optional] |
Results​
Integer/Float - The value provided rounded to the specified decimal places.
Examples​
Code Snippet
round(3.829839, 2) //returns 3.83