W3cubDocs

/Nushell

math round for math

Returns the input number rounded to the specified precision.

Signature

> math round {flags}

Flags

  • --precision, -p {number}: digits of precision

Input/output types:

input output
list<number> list<number>
number number

Examples

Apply the round function to a list of numbers

> [1.52.3-3.1] |math round
╭───┬────╮
02
12
2-3
╰───┴────╯

Apply the round function with precision specified

> [1.5552.333-3.111] |math round-p2
╭───┬───────╮
01.56
12.33
2-3.11
╰───┴───────╯

Apply negative precision to a list of numbers

> [123, 123.3, -123.4] |math round-p-1
╭───┬──────╮
0120
1120
2-120
╰───┴──────╯

Copyright © 2019–2023 The Nushell Project DevelopersLicensed under the MIT License.
https://www.nushell.sh/commands/docs/math_round.html