From 66bd294256e02087fe5a84c54ebc1269a92f6a5c Mon Sep 17 00:00:00 2001 From: YakoYakoYokuYoku <39890836+YakoYakoYokuYoku@users.noreply.github.com> Date: Thu, 14 Feb 2019 21:56:50 -0300 Subject: [PATCH] Update float.rs --- src/float.rs | 4 ---- src/lib.rs | 1 + src/real.rs | 53 ---------------------------------------------------- 3 files changed, 1 insertion(+), 57 deletions(-) diff --git a/src/float.rs b/src/float.rs index de456aa..4004593 100644 --- a/src/float.rs +++ b/src/float.rs @@ -1905,9 +1905,6 @@ pub trait CommonFloat where Self: Num + Copy + NumCast + Neg { /// Take the reciprocal (inverse) of a number, `1/x`. fn recip(self) -> Self; - /// Raise a number to a floating point power. - fn powf(self, n: Self) -> Self; - /// Takes self to the power of a. /// /// Returns NaN if self is negative. @@ -2078,7 +2075,6 @@ macro_rules! cfloat_impl { Float::is_nan(self) -> bool; Float::mul_add(self, a: Self, b: Self) -> Self; Float::recip(self) -> Self; - Float::powf(self, n: Self) -> Self; Float::sqrt(self) -> Self; Float::exp(self) -> Self; Float::exp2(self) -> Self; diff --git a/src/lib.rs b/src/lib.rs index 172e714..cf2d41d 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -29,6 +29,7 @@ pub use bounds::Bounded; #[cfg(feature = "std")] pub use float::Float; pub use float::FloatConst; +pub use float::CommonFloat; // pub use real::{FloatCore, Real}; // NOTE: Don't do this, it breaks `use num_traits::*;`. pub use cast::{cast, AsPrimitive, FromPrimitive, NumCast, ToPrimitive}; pub use identities::{one, zero, One, Zero}; diff --git a/src/real.rs b/src/real.rs index 61754d1..4aa85fa 100644 --- a/src/real.rs +++ b/src/real.rs @@ -13,7 +13,6 @@ use {Float, Num, NumCast}; /// /// This trait is only available with the `std` feature. pub trait Real: Num + Copy + NumCast + PartialOrd + Neg { - type Typo; /// Returns the smallest finite value that this type can represent. /// /// ``` @@ -776,61 +775,9 @@ pub trait Real: Num + Copy + NumCast + PartialOrd + Neg { /// assert!(abs_difference < 1.0e-10); /// ``` fn atanh(self) -> Self; - - /// Returns the real part of the float. - /// - /// ``` - /// use num_traits::Float; - /// - /// let n = 0.5f64; - /// - /// assert!(n.real() > 0.4f64); - /// ``` - fn real(self) -> Self; - - /// Returns the imaginary part of the float which equals to zero. - /// - /// ``` - /// use num_traits::Float; - /// - /// let n = 2.7f64; - /// - /// assert!(n.imag() == 0.0f64); - /// ``` - fn imag(self) -> Self; - - /// Computes the argument of the float.Float - /// - /// ``` - /// use num_traits::Float; - /// - /// let n = 0.8f32; - /// - /// assert_eq!(n.arg(), 0.0f32); - /// ``` - fn arg(self) -> Self; } impl Real for T { - type Typo = T; - #[inline] - fn real(self) -> T { - self - } - #[inline] - fn imag(self) -> T { - T::neg_zero() - } - - #[inline] - fn arg(self) -> Self::Typo { - if self >= T::from(0).unwrap() { - T::from(0).unwrap() - } else { - T::from(3.14159265358979323846264338327950288_f64).unwrap() - } - } - forward! { Float::min_value() -> Self; Float::min_positive_value() -> Self;