summaryrefslogtreecommitdiff
path: root/library/src
diff options
context:
space:
mode:
Diffstat (limited to 'library/src')
-rw-r--r--library/src/math/delimited.rs18
-rw-r--r--library/src/math/mod.rs1
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());