math round
for math
Returns the input number rounded to the specified precision.
Signature
> math round --precision
Parameters
--precision {number}
: digits of precision
Examples
Apply the round function to a list of numbers
> [1.5 2.3 -3.1] | math round
╭───┬────╮
│ 0 │ 2 │
│ 1 │ 2 │
│ 2 │ -3 │
╰───┴────╯
Apply the round function with precision specified
> [1.555 2.333 -3.111] | math round -p 2
╭───┬─────────╮
│ 0 │ 1.5600 │
│ 1 │ 2.3300 │
│ 2 │ -3.1100 │
╰───┴─────────╯
Apply negative precision to a list of numbers
> [123, 123.3, -123.4] | math round -p -1
╭───┬──────╮
│ 0 │ 120 │
│ 1 │ 120 │
│ 2 │ -120 │
╰───┴──────╯