#![no_std]
#[cfg(feature = "alloc")]
extern crate alloc;
pub mod ode;
pub mod quadrature;
pub mod report;
pub mod roots;
#[cfg(feature = "alloc")]
pub mod sensitivity;
pub mod stiff;
pub use report::{SolveReport, SolveStatus};
pub use num_traits::{
cast, float::FloatConst, real::Real, CheckedAdd, CheckedDiv, CheckedMul, CheckedNeg,
CheckedRem, CheckedShl, CheckedShr, CheckedSub, Float, FromPrimitive, Inv, Num, NumAssign,
NumAssignOps, NumCast, NumOps, One, Pow, PrimInt, Signed, ToPrimitive, Unsigned, Zero,
};
pub use num_traits;
#[cfg(feature = "libm")]
pub use libm;
pub trait Scalar: Float + NumCast + FloatConst {}
impl<T: Float + NumCast + FloatConst> Scalar for T {}
pub mod prelude {
pub use crate::{Float, FloatConst, Num, NumCast, One, Real, Scalar, Signed, Unsigned, Zero};
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn scalar_is_implemented_for_f64() {
fn takes_scalar<T: Scalar>(_: T) {}
takes_scalar(1.0_f64);
takes_scalar(1.0_f32);
}
#[test]
fn constants_are_available() {
assert!((f64::E() - core::f64::consts::E).abs() < 1e-12);
assert!((f64::PI() - core::f64::consts::PI).abs() < 1e-12);
}
#[test]
fn cast_roundtrip() {
let x: f64 = 3.5;
let y: i64 = NumCast::from(x).unwrap();
assert_eq!(y, 3);
}
}