Skip to content

Commit

Permalink
make floor and ceiling subscripts experimental
Browse files Browse the repository at this point in the history
  • Loading branch information
kaikalii committed Nov 25, 2024
1 parent 9aae1b5 commit 11a07fe
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
4 changes: 2 additions & 2 deletions site/src/other.rs
Original file line number Diff line number Diff line change
Expand Up @@ -512,8 +512,8 @@ pub fn Subscripts() -> impl IntoView {
subscript(Transpose, "Repeat", "# Experimental!\n△ ⍉₃ °△1_2_3_4_5"),
subscript(Sqrt, "Nth root", "√₃ [8 27 125]"),
subscript(Round, "To N decimal places", "⁅₃ π"),
subscript(Floor, "To N decimal places", "⌊₄ π\n⌊₄ τ"),
subscript(Ceil, "To N decimal places", "⌈₄ π\n⌈₄ τ"),
subscript(Floor, "To N decimal places", "# Experimental!\n⌊₄ π\n⌊₄ τ"),
subscript(Ceil, "To N decimal places", "# Experimental!\n⌈₄ π\n⌈₄ τ"),
subscript(Rand, "Random integer", "# Experimental!\n⚂₁₀₀"),
subscript(Both, "Apply to N argument sets", "[∩₃+ 1 2 3 4 5 6]"),
subscript(Each, "Apply to rank N subarrays", "∵₁□ °△2_3_4"),
Expand Down
13 changes: 12 additions & 1 deletion src/compile/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1927,7 +1927,18 @@ code:
self.primitive(Primitive::Pow, span),
])
}
Primitive::Round | Primitive::Floor | Primitive::Ceil => {
Primitive::Floor | Primitive::Ceil => {
self.subscript_experimental(prim, &span);
let mul = 10f64.powi(n);
Node::from_iter([
Node::new_push(mul),
self.primitive(Primitive::Mul, span.clone()),
self.primitive(prim, span.clone()),
Node::new_push(mul),
self.primitive(Primitive::Div, span),
])
}
Primitive::Round => {
let mul = 10f64.powi(n);
Node::from_iter([
Node::new_push(mul),
Expand Down

0 comments on commit 11a07fe

Please sign in to comment.