feat(const_eval): impl. step

This commit is contained in:
Erich Gubler committed 2024-01-18 16:57:46 -05:00
1 parent f2dbdfcdc6
commit 6f5b2a64e2
2 files changed
+6

No files matched your search

+1
View File
@@ -49,6 +49,7 @@ Bottom level categories:
- `sin`
- `sinh`
- `sqrt`
- `step`
## v0.19.0 (2024-01-17)
+5
View File
@@ -859,6 +859,11 @@ impl<'a> ConstantEvaluator<'a> {
crate::MathFunction::Sqrt => {
component_wise_float!(self, span, [arg], |e| { Ok([e.sqrt()]) })
}
crate::MathFunction::Step => {
component_wise_float!(self, span, [arg, arg1.unwrap()], |edge, x| {
Ok([if edge <= x { 1.0 } else { 0.0 }])
})
}
fun => Err(ConstantEvaluatorError::NotImplemented(format!(
"{fun:?} built-in function"
))),