pub struct SafeDivide { /* private fields */ }Implementations§
Source§impl SafeDivide
impl SafeDivide
Trait Implementations§
Source§impl ComputePrimitive for SafeDivide
impl ComputePrimitive for SafeDivide
Source§fn compute(
&self,
inputs: &HashMap<String, Value>,
parameters: &HashMap<String, Value>,
_state: Option<&mut PrimitiveState>,
) -> Result<HashMap<String, Value>, ComputeError>
fn compute( &self, inputs: &HashMap<String, Value>, parameters: &HashMap<String, Value>, _state: Option<&mut PrimitiveState>, ) -> Result<HashMap<String, Value>, ComputeError>
Safe divide with explicit fallback.
Returns fallback when:
b == 0.0(would be division by zero)- Result is non-finite (overflow)
This implementation never errors for zero/non-finite conditions. The author explicitly chooses the fallback value, encoding domain policy.
Note: fallback must be a finite number. If fallback is NaN or
infinity, safe_divide will return it, and the NUM-FINITE-1 runtime guard
will raise ExecError::NonFiniteOutput.
See: B.2 in PHASE_INVARIANTS.md
fn manifest(&self) -> &ComputePrimitiveManifest
Auto Trait Implementations§
impl Freeze for SafeDivide
impl RefUnwindSafe for SafeDivide
impl Send for SafeDivide
impl Sync for SafeDivide
impl Unpin for SafeDivide
impl UnsafeUnpin for SafeDivide
impl UnwindSafe for SafeDivide
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more