round()

Table of Contents
This command is experimental

Definition

round() takes a numerical value and rounds it to the specific decimal defined by the user. If the user doesn’t specify a precision, round() will round the value to the nearest whole integer.

For other rounding functions, you can use ceiling() or floor().

Examples

The following example rounds 2.5 to the nearest whole integer, since the precision isn’t defined. The query returns 3 as the result.

| makeresults
| eval test = round(2.5)
Screenshot of the previous example’s result

The following example rounds 1.4932 to two decimal places and returns 1.49.

| makeresults
| eval test = round(1.4932, 2)
Screenshot of the previous example’s result

Currently, if the last decimal turns into 0 while the value is rounded, round() omits it. See the issue on GitHub.

Further Reading