use std::fmt;
use std::marker::Sized;
use std::cmp::Ordering;
#[cfg(feature = "rug")]
mod complexrugrat;
#[cfg(feature = "rug")]
mod rugrat;
#[cfg(feature = "rug")]
mod rugcomplex;
mod complexfloat;
mod float64;
#[cfg(feature = "rug")]
pub use self::complexrugrat::ComplexRugRat;
#[cfg(feature = "rug")]
pub use self::complexfloat::ComplexFloat;
use crate::opers::Calculation;
use crate::errors::MathError;
use crate::context::Context;
#[allow(missing_docs)]
pub trait Num: fmt::Debug + fmt::Display + Clone + PartialEq
where
Self: Sized,
{
fn from_f64(t: f64, ctx: &Context<Self>) -> Calculation<Self>;
fn from_f64_complex(t: (f64, f64), ctx: &Context<Self>) -> Calculation<Self>;
fn typename() -> String;
fn tryord(&self, _other: &Self, _ctx: &Context<Self>) -> Result<Ordering, MathError> {
Err(MathError::Unimplemented {
op: "Comparison".to_string(),
num_type: Self::typename(),
})
}
fn add(&self, _other: &Self, _ctx: &Context<Self>) -> Calculation<Self> {
Err(MathError::Unimplemented {
op: "Addition".to_string(),
num_type: Self::typename(),
})
}
fn sub(&self, _other: &Self, _ctx: &Context<Self>) -> Calculation<Self> {
Err(MathError::Unimplemented {
op: "Subtraction".to_string(),
num_type: Self::typename(),
})
}
fn mul(&self, _other: &Self, _ctx: &Context<Self>) -> Calculation<Self> {
Err(MathError::Unimplemented {
op: "Multiplication".to_string(),
num_type: Self::typename(),
})
}
fn div(&self, _other: &Self, _ctx: &Context<Self>) -> Calculation<Self> {
Err(MathError::Unimplemented {
op: "Division".to_string(),
num_type: Self::typename(),
})
}
fn pow(&self, _other: &Self, _ctx: &Context<Self>) -> Calculation<Self> {
Err(MathError::Unimplemented {
op: "Exponent".to_string(),
num_type: Self::typename(),
})
}
fn sqrt(&self, _ctx: &Context<Self>) -> Calculation<Self> {
Err(MathError::Unimplemented {
op: "Square Root".to_string(),
num_type: Self::typename(),
})
}
fn nrt(&self, _other: &Self, _ctx: &Context<Self>) -> Calculation<Self> {
Err(MathError::Unimplemented {
op: "Nth Root".to_string(),
num_type: Self::typename(),
})
}
fn abs(&self, _ctx: &Context<Self>) -> Calculation<Self> {
Err(MathError::Unimplemented {
op: "Absolute Value".to_string(),
num_type: Self::typename(),
})
}
fn sin(&self, _ctx: &Context<Self>) -> Calculation<Self> {
Err(MathError::Unimplemented {
op: "Sine".to_string(),
num_type: Self::typename(),
})
}
fn cos(&self, _ctx: &Context<Self>) -> Calculation<Self> {
Err(MathError::Unimplemented {
op: "Cosine".to_string(),
num_type: Self::typename(),
})
}
fn tan(&self, _ctx: &Context<Self>) -> Calculation<Self> {
Err(MathError::Unimplemented {
op: "Tangent".to_string(),
num_type: Self::typename(),
})
}
fn asin(&self, _ctx: &Context<Self>) -> Calculation<Self> {
Err(MathError::Unimplemented {
op: "Arc Sine".to_string(),
num_type: Self::typename(),
})
}
fn acos(&self, _ctx: &Context<Self>) -> Calculation<Self> {
Err(MathError::Unimplemented {
op: "Arc Cosine".to_string(),
num_type: Self::typename(),
})
}
fn atan(&self, _ctx: &Context<Self>) -> Calculation<Self> {
Err(MathError::Unimplemented {
op: "Arc Tangent".to_string(),
num_type: Self::typename(),
})
}
fn atan2(&self, _other: &Self, _ctx: &Context<Self>) -> Calculation<Self> {
Err(MathError::Unimplemented {
op: "Atan2".to_string(),
num_type: Self::typename(),
})
}
fn floor(&self, _ctx: &Context<Self>) -> Calculation<Self> {
Err(MathError::Unimplemented {
op: "Flooring".to_string(),
num_type: Self::typename(),
})
}
fn ceil(&self, _ctx: &Context<Self>) -> Calculation<Self> {
Err(MathError::Unimplemented {
op: "Ceiling".to_string(),
num_type: Self::typename(),
})
}
fn round(&self, _ctx: &Context<Self>) -> Calculation<Self> {
Err(MathError::Unimplemented {
op: "Rounding".to_string(),
num_type: Self::typename(),
})
}
fn log(&self, _other: &Self, _ctx: &Context<Self>) -> Calculation<Self> {
Err(MathError::Unimplemented {
op: "Logarithm".to_string(),
num_type: Self::typename(),
})
}
}