Trait oxidd_core::function::NumberBase
source · pub trait NumberBase: Clone + Eq + Hash + PartialOrd {
// Required methods
fn zero() -> Self;
fn one() -> Self;
fn nan() -> Self;
fn add(&self, rhs: &Self) -> Self;
fn sub(&self, rhs: &Self) -> Self;
fn mul(&self, rhs: &Self) -> Self;
fn div(&self, rhs: &Self) -> Self;
// Provided methods
fn is_zero(&self) -> bool { ... }
fn is_one(&self) -> bool { ... }
fn is_nan(&self) -> bool { ... }
}Expand description
Basic trait for numbers
zero(), one(), and nan() are
implemented as functions because depending on the number underlying type,
it can be hard/impossible to obtain a const for these values.
This trait also includes basic arithmetic methods. This is to avoid cloning
of big integers. We could also require &Self: Add<&Self, Output = Self>
etc., but this would lead to ugly trait bounds.
Used by PseudoBooleanFunction::Number
Required Methods§
Provided Methods§
Object Safety§
This trait is not object safe.