github.com/lmorg/murex@v0.0.0-20240217211045-e081c89cd4ef/docs/commands/round.md (about) 1 # `round` 2 3 > Round a number by a user defined precision 4 5 ## Description 6 7 `round` supports a few different levels of precision: 8 9 ### Nearest decimal place 10 11 Syntax: `0.12345` (any numbers can be used) 12 13 If a decimal place is supplied then `round` will round your number to however 14 many decimal places you specify. It doesn't matter what digits you include in 15 your precision value as the only thing which is used to drive the result is the 16 position of the decimal point. Thus a precision value of `0.000` would perform 17 the same rounding as `9.999`. 18 19 Decimal places are always rounded to the nearest. `--down` and `--up` flags are 20 not supported. 21 22 ### Nearest integer 23 24 Syntax: either `0` or `1` (either behaves the same) 25 26 This will round your value to the nearest whole number. For example `3.33` 27 would be rounded to `3`. 28 29 If `--down` flag is supplied then the remainder is dropped. For example `9.99` 30 would then be rounded to `9` instead of `10`. 31 32 If `--up` flag is is supplied then the the input value would always be rounded 33 up to the nearest whole number. For example `3.33` would be rounded to `4` 34 instead of `3`. 35 36 ### Nearest Multiple 37 38 Syntax: `50` (any integer greater than `1) 39 40 This will round your input value to the nearest multiple of your precision. 41 42 Like with **nearest integer** (see above), `--down` and `--up` will specify to 43 round whether to always round down or up rather than returning the nearest 44 match in either direction. 45 46 ## Usage 47 48 ``` 49 round value precision -> <stdout> 50 ``` 51 52 ## Examples 53 54 **Rounding to the nearest multiple of `20`:** 55 56 ``` 57 ยป round 15 20 58 20 59 ``` 60 61 ## Flags 62 63 * `--down` 64 Rounds down to the nearest multiple (not supported when precision is to decimal places) 65 * `--up` 66 Rounds up to the nearest multiple (not supported when precision is to decimal places) 67 * `-d` 68 shorthand for `--down` 69 * `-u` 70 shorthand for `--up` 71 72 ## See Also 73 74 * [`expr`](../commands/expr.md): 75 Expressions: mathematical, string comparisons, logical operators 76 77 <hr/> 78 79 This document was generated from [builtins/core/typemgmt/round_doc.yaml](https://github.com/lmorg/murex/blob/master/builtins/core/typemgmt/round_doc.yaml).