feat(const_eval): impl. step

This commit is contained in:
Erich Gubler 2023-12-14 10:41:51 -05:00
parent f2dbdfcdc6
commit 6f5b2a64e2
2 changed files with 6 additions and 0 deletions

View File

@ -49,6 +49,7 @@ Bottom level categories:
- `sin`
- `sinh`
- `sqrt`
- `step`
## v0.19.0 (2024-01-17)

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"
))),