Add NumCast to FloatCore, matching Float

This commit is contained in:
Josh Stone 2018-02-27 14:43:31 -08:00
parent ac503261ca
commit 7d6575da0f
1 changed files with 2 additions and 4 deletions

View File

@ -6,14 +6,12 @@ use core::num::FpCategory;
#[cfg(feature = "std")] #[cfg(feature = "std")]
use std::f32; use std::f32;
use {Num, ToPrimitive}; use {Num, NumCast, ToPrimitive};
#[cfg(feature = "std")]
use NumCast;
/// Generic trait for floating point numbers that works with `no_std`. /// Generic trait for floating point numbers that works with `no_std`.
/// ///
/// This trait implements a subset of the `Float` trait. /// This trait implements a subset of the `Float` trait.
pub trait FloatCore: Num + Neg<Output = Self> + PartialOrd + Copy { pub trait FloatCore: Num + NumCast + Neg<Output = Self> + PartialOrd + Copy {
/// Returns positive infinity. /// Returns positive infinity.
fn infinity() -> Self; fn infinity() -> Self;