pub enum MathError {
DomainError {
operation: String,
value: Expression,
reason: String,
},
DivisionByZero,
Undefined {
expression: Expression,
reason: String,
},
NumericOverflow {
operation: String,
},
NotImplemented {
feature: String,
},
Pole {
function: String,
at: Expression,
},
BranchCut {
function: String,
value: Expression,
},
InvalidInterval {
lower: f64,
upper: f64,
},
MaxIterationsReached {
max_iterations: usize,
},
ConvergenceFailed {
reason: String,
},
NonNumericalResult {
expression: Expression,
},
}Expand description
Comprehensive mathematical error type
Represents all possible error conditions that can occur during mathematical operations, including domain violations, singularities, and undefined behavior.
Variants§
DomainError
Domain error - operation not valid for given input
§Examples
- sqrt(-1) in real domain
- arcsin(2) in real domain (domain is [-1, 1])
DivisionByZero
Undefined
NumericOverflow
Numeric overflow during computation
NotImplemented
Feature not yet implemented
Pole
BranchCut
Branch cut issue for multi-valued functions
§Examples
- log(-1) in real domain (requires complex domain)
- sqrt(-1) in real domain (branch cut on negative real axis)
InvalidInterval
MaxIterationsReached
Maximum iterations reached without convergence
ConvergenceFailed
Convergence failure in iterative method
NonNumericalResult
Non-numerical result from evaluation
§Examples
- Attempting to convert symbolic expression to f64
- Evaluation resulted in non-numeric expression
Fields
§
expression: ExpressionTrait Implementations§
Source§impl Error for MathError
impl Error for MathError
1.30.0§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0: use the Display impl or to_string()
impl StructuralPartialEq for MathError
Auto Trait Implementations§
impl Freeze for MathError
impl RefUnwindSafe for MathError
impl Send for MathError
impl Sync for MathError
impl Unpin for MathError
impl UnwindSafe for MathError
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
🔬This is a nightly-only experimental API. (
clone_to_uninit)Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more