diff options
| author | Laurenz <laurmaedje@gmail.com> | 2023-03-27 20:23:37 +0200 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2023-03-27 20:23:37 +0200 |
| commit | 66de90437f64e532a51297dc233c57c2cda9a124 (patch) | |
| tree | 0a51c661b3c2a57182de34f881e848c7572c3ff5 /library/src/math | |
| parent | f33103cf58f920f8e05ee7fadba9c377095edef8 (diff) | |
Update fibonacci example and add `round` function
Diffstat (limited to 'library/src/math')
| -rw-r--r-- | library/src/math/delimited.rs | 18 | ||||
| -rw-r--r-- | library/src/math/mod.rs | 1 |
2 files changed, 19 insertions, 0 deletions
diff --git a/library/src/math/delimited.rs b/library/src/math/delimited.rs index 3be17eae..fe7d2d1e 100644 --- a/library/src/math/delimited.rs +++ b/library/src/math/delimited.rs @@ -141,6 +141,24 @@ pub fn ceil( delimited(body, '⌈', '⌉') } +/// Round an expression. +/// +/// ## Example +/// ```example +/// $ round(x/2) $ +/// ``` +/// +/// Display: Round +/// Category: math +/// Returns: content +#[func] +pub fn round( + /// The expression to round. + body: Content, +) -> Value { + delimited(body, '⌊', '⌉') +} + /// Take the absolute value of an expression. /// /// ## Example diff --git a/library/src/math/mod.rs b/library/src/math/mod.rs index 4e91dd51..b4a5b156 100644 --- a/library/src/math/mod.rs +++ b/library/src/math/mod.rs @@ -57,6 +57,7 @@ pub fn module() -> Module { math.define("norm", norm); math.define("floor", floor); math.define("ceil", ceil); + math.define("round", round); // Attachments and accents. math.define("attach", AttachElem::func()); |
