Add rounding functionalties (#2672)

* added math round

* added math floor

* added math ceil

* added math.md examples

* moved the detection of nonnumerical values in ceil/floor/round

* math round now works on streams

* math floor now works on streams

* math ceil now works on streams
This commit is contained in:
morbatex
2020-10-22 02:18:27 +02:00
committed by GitHub
parent cc06ea4d87
commit 0d8064ed2d
8 changed files with 329 additions and 3 deletions

View File

@ -4,11 +4,14 @@ 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 ceil`: Applies the ceil function to a list of numbers
* [`math eval`](math-eval.md): Evaluates a list of math expressions into numbers
* `math floor`: Applies the floor function to a list of numbers
* `math max`: Finds the maximum within a list of numbers or tables
* `math median`: Finds the median of a list of numbers or tables
* `math min`: Finds the minimum within a list of numbers or tables
* `math mode`: Finds the most frequent element(s) within a list of numbers or tables
* `math round`: Applies the round function to a list of numbers
* `math stddev`: Finds the standard deviation of a list of numbers or tables
* `math sum`: Finds the sum of a list of numbers or tables
* `math product`: Finds the product of a list of numbers or tables
@ -117,6 +120,33 @@ To get the average of the file sizes in a directory, simply pipe the size column
328.96
```
```shell
> echo [1.5 2.3 -3.1] | math ceil
───┬────
02
13
2 │ -3
───┴────
```
```shell
> echo [1.5 2.3 -3.1] | math floor
───┬────
01
12
2 │ -4
───┴────
```
```shell
> echo [1.5 2.3 -3.1] | math round
───┬────
02
12
2 │ -3
───┴────
```
### Dates
```shell