Nushell
Get Nu!
Getting Started
  • The Nushell Book
  • Command Reference
  • Cookbook
  • Language Reference Guide
  • Contributing Guide
Blog
  • English
  • 中文
  • Deutsch
  • Français
  • Español
  • 日本語
  • Português do Brasil
  • Русский язык
GitHub
Get Nu!
Getting Started
  • The Nushell Book
  • Command Reference
  • Cookbook
  • Language Reference Guide
  • Contributing Guide
Blog
  • English
  • 中文
  • Deutsch
  • Français
  • Español
  • 日本語
  • Português do Brasil
  • Русский язык
GitHub
  • Categories

    • Bits
    • Bytes
    • Chart
    • Conversions
    • Core
    • Database
    • Dataframe
    • Dataframe Or Lazyframe
    • Date
    • Debug
    • Default
    • Env
    • Experimental
    • Expression
    • Filesystem
    • Filters
    • Formats
    • Generators
    • Hash
    • History
    • Lazyframe
    • Math
    • Misc
    • Network
    • Path
    • Platform
    • Plugin
    • Prompt
    • Random
    • Removed
    • Shells
    • Strings
    • System
    • Viewers

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:

inputoutput
list<number>list<number>
numbernumber
rangelist<number>

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 --precision 2
╭───┬───────╮
│ 0 │  1.56 │
│ 1 │  2.33 │
│ 2 │ -3.11 │
╰───┴───────╯

Apply negative precision to a list of numbers

> [123, 123.3, -123.4] | math round --precision -1
╭───┬──────╮
│ 0 │  120 │
│ 1 │  120 │
│ 2 │ -120 │
╰───┴──────╯