1 2 3 4 5 6 7 8 9 10
use num::{Float, ToPrimitive}; /// Convert a numeric literal or integer index into the target float type. #[inline] pub(crate) fn cast<T>(value: impl ToPrimitive) -> T where T: Float, { T::from(value).expect("numeric constant must be representable") }