mirror of
https://github.com/nushell/nushell.git
synced 2025-06-30 22:50:14 +02:00
Rename calc
to math eval
and allow it to optionally take an expression as an argument (#2195)
* Rename `calc` to `math eval` and allow it to optionally take the expression as an argument * Moved calc tests to math eval Also added 2 tests and changed 1 test * Move calc docs to math eval
This commit is contained in:
@ -4,6 +4,7 @@ Mathematical functions that generally only operate on a list of numbers (integer
|
||||
Currently the following functions are implemented:
|
||||
|
||||
* `math avg`: Finds the average of a list of numbers or tables
|
||||
* [`math eval`](math-eval.md): Evaluates a list of math expressions into numbers
|
||||
* `math min`: Finds the minimum within a list of numbers or tables
|
||||
* `math max`: Finds the maximum within a list of numbers or tables
|
||||
* `math median`: Finds the median of a list of numbers or tables
|
||||
@ -152,11 +153,3 @@ To get the sum of the characters that make up your present working directory.
|
||||
> echo [] | math avg
|
||||
error: Error: Unexpected: Cannot perform aggregate math operation on empty data
|
||||
```
|
||||
|
||||
Note `math` functions only work on list of numbers (integers, decimals, bytes) and tables of numbers, if any other types are piped into the function
|
||||
then unexpected results can occur.
|
||||
|
||||
```shell
|
||||
> echo [1 2 a ] | math avg
|
||||
0
|
||||
```
|
||||
|
Reference in New Issue
Block a user