Merge pull request #99 from b52/issue-93-float-min-positive
Provide generic around f32/f64::MIN_POSITIVE
This commit is contained in:
commit
0a7847cd65
|
@ -1406,6 +1406,18 @@ pub trait Float
|
||||||
/// ```
|
/// ```
|
||||||
fn min_value() -> Self;
|
fn min_value() -> Self;
|
||||||
|
|
||||||
|
/// Returns the smallest positive, normalized value that this type can represent.
|
||||||
|
///
|
||||||
|
/// ```
|
||||||
|
/// use num::traits::Float;
|
||||||
|
/// use std::f64;
|
||||||
|
///
|
||||||
|
/// let x: f64 = Float::min_positive_value();
|
||||||
|
///
|
||||||
|
/// assert_eq!(x, f64::MIN_POSITIVE);
|
||||||
|
/// ```
|
||||||
|
fn min_positive_value() -> Self;
|
||||||
|
|
||||||
/// Returns the largest finite value that this type can represent.
|
/// Returns the largest finite value that this type can represent.
|
||||||
///
|
///
|
||||||
/// ```
|
/// ```
|
||||||
|
@ -2207,6 +2219,10 @@ macro_rules! float_impl {
|
||||||
::std::$T::MIN
|
::std::$T::MIN
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn min_positive_value() -> Self {
|
||||||
|
::std::$T::MIN_POSITIVE
|
||||||
|
}
|
||||||
|
|
||||||
fn max_value() -> Self {
|
fn max_value() -> Self {
|
||||||
::std::$T::MAX
|
::std::$T::MAX
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue