Local Changes

This commit is contained in:
4Y 2019-02-13 18:35:33 -03:00
commit 67c311387e
2 changed files with 61 additions and 0 deletions

View File

@ -1836,6 +1836,52 @@ pub trait Float where Self: Num + Copy + NumCast + Neg<Output = Self> {
/// assert!(abs_difference < 1e-10);
/// ```
fn integer_decode(self) -> (u64, i16, i8);
/// Returns the real part of the float.
///
/// ```
/// use num_traits::Float;
///
/// let n = 0.5f64;
///
/// assert!(n.real() > 0.4f64);
/// ```
#[inline]
fn real(self) -> 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);
/// ```
#[inline]
fn imag(self) -> Self {
Self::zero()
}
/// Computes the argument of the float
///
/// ```
/// use num_traits::Float;
///
/// let r = 0.8f64;
///
/// assert_eq!(r.arg(), 0.0f64);
/// ```
#[inline]
fn arg(self) -> Self {
if self >= Self::zero() {
Self::zero()
} else {
Self::from(f64::consts::PI).unwrap()
}
}
}
#[cfg(feature = "std")]

View File

@ -786,7 +786,11 @@ pub trait Real: Num + Copy + NumCast + PartialOrd + Neg<Output = Self> {
///
/// assert!(n.real() > 0.4f64);
/// ```
<<<<<<< HEAD
fn real(self) -> Self::Typo;
=======
fn real(self) -> Self;
>>>>>>> e2ea775447e536007f4f4cac3d90d02f294d16c0
/// Returns the imaginary part of the float which equals to zero.
///
@ -797,7 +801,11 @@ pub trait Real: Num + Copy + NumCast + PartialOrd + Neg<Output = Self> {
///
/// assert!(n.imag() == 0.0f64);
/// ```
<<<<<<< HEAD
fn imag(self) -> Self::Typo;
=======
fn imag(self) -> Self;
>>>>>>> e2ea775447e536007f4f4cac3d90d02f294d16c0
/// Computes the argument of the float.Float
///
@ -808,7 +816,11 @@ pub trait Real: Num + Copy + NumCast + PartialOrd + Neg<Output = Self> {
///
/// assert_eq!(n.arg(), 0.0f32);
/// ```
<<<<<<< HEAD
fn arg(self) -> Self::Typo;
=======
fn arg(self) -> Self;
>>>>>>> e2ea775447e536007f4f4cac3d90d02f294d16c0
}
impl<T: Float + PartialOrd> Real for T {
@ -881,5 +893,8 @@ impl<T: Float + PartialOrd> Real for T {
Float::asinh(self) -> Self;
Float::acosh(self) -> Self;
Float::atanh(self) -> Self;
Float::real(self) -> Self;
Float::imag(self) -> Self;
Float::arg(self) -> Self;
}
}