Rollup merge of #34277 - ollie27:docs_num, r=steveklabnik
Add/improve num const docs This adds short summaries to all num consts. r? @steveklabnik
This commit is contained in:
commit
62bae0ad42
5 changed files with 64 additions and 65 deletions
|
@ -20,53 +20,53 @@ use mem;
|
|||
use num::Float;
|
||||
use num::FpCategory as Fp;
|
||||
|
||||
/// The radix or base of the internal representation of `f32`.
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[allow(missing_docs)]
|
||||
pub const RADIX: u32 = 2;
|
||||
|
||||
/// Number of significant digits in base 2.
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[allow(missing_docs)]
|
||||
pub const MANTISSA_DIGITS: u32 = 24;
|
||||
/// Approximate number of significant digits in base 10.
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[allow(missing_docs)]
|
||||
pub const DIGITS: u32 = 6;
|
||||
|
||||
/// Difference between `1.0` and the next largest representable number.
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[allow(missing_docs)]
|
||||
pub const EPSILON: f32 = 1.19209290e-07_f32;
|
||||
|
||||
/// Smallest finite f32 value
|
||||
/// Smallest finite `f32` value.
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub const MIN: f32 = -3.40282347e+38_f32;
|
||||
/// Smallest positive, normalized f32 value
|
||||
/// Smallest positive normal `f32` value.
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub const MIN_POSITIVE: f32 = 1.17549435e-38_f32;
|
||||
/// Largest finite f32 value
|
||||
/// Largest finite `f32` value.
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub const MAX: f32 = 3.40282347e+38_f32;
|
||||
|
||||
/// One greater than the minimum possible normal power of 2 exponent.
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[allow(missing_docs)]
|
||||
pub const MIN_EXP: i32 = -125;
|
||||
/// Maximum possible power of 2 exponent.
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[allow(missing_docs)]
|
||||
pub const MAX_EXP: i32 = 128;
|
||||
|
||||
/// Minimum possible normal power of 10 exponent.
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[allow(missing_docs)]
|
||||
pub const MIN_10_EXP: i32 = -37;
|
||||
/// Maximum possible power of 10 exponent.
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[allow(missing_docs)]
|
||||
pub const MAX_10_EXP: i32 = 38;
|
||||
|
||||
/// Not a Number (NaN).
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[allow(missing_docs)]
|
||||
pub const NAN: f32 = 0.0_f32/0.0_f32;
|
||||
/// Infinity (∞).
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[allow(missing_docs)]
|
||||
pub const INFINITY: f32 = 1.0_f32/0.0_f32;
|
||||
/// Negative infinity (-∞).
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[allow(missing_docs)]
|
||||
pub const NEG_INFINITY: f32 = -1.0_f32/0.0_f32;
|
||||
|
||||
/// Basic mathematical constants.
|
||||
|
@ -74,67 +74,67 @@ pub const NEG_INFINITY: f32 = -1.0_f32/0.0_f32;
|
|||
pub mod consts {
|
||||
// FIXME: replace with mathematical constants from cmath.
|
||||
|
||||
/// Archimedes' constant
|
||||
/// Archimedes' constant (π)
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub const PI: f32 = 3.14159265358979323846264338327950288_f32;
|
||||
|
||||
/// pi/2.0
|
||||
/// π/2
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub const FRAC_PI_2: f32 = 1.57079632679489661923132169163975144_f32;
|
||||
|
||||
/// pi/3.0
|
||||
/// π/3
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub const FRAC_PI_3: f32 = 1.04719755119659774615421446109316763_f32;
|
||||
|
||||
/// pi/4.0
|
||||
/// π/4
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub const FRAC_PI_4: f32 = 0.785398163397448309615660845819875721_f32;
|
||||
|
||||
/// pi/6.0
|
||||
/// π/6
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub const FRAC_PI_6: f32 = 0.52359877559829887307710723054658381_f32;
|
||||
|
||||
/// pi/8.0
|
||||
/// π/8
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub const FRAC_PI_8: f32 = 0.39269908169872415480783042290993786_f32;
|
||||
|
||||
/// 1.0/pi
|
||||
/// 1/π
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub const FRAC_1_PI: f32 = 0.318309886183790671537767526745028724_f32;
|
||||
|
||||
/// 2.0/pi
|
||||
/// 2/π
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub const FRAC_2_PI: f32 = 0.636619772367581343075535053490057448_f32;
|
||||
|
||||
/// 2.0/sqrt(pi)
|
||||
/// 2/sqrt(π)
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub const FRAC_2_SQRT_PI: f32 = 1.12837916709551257389615890312154517_f32;
|
||||
|
||||
/// sqrt(2.0)
|
||||
/// sqrt(2)
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub const SQRT_2: f32 = 1.41421356237309504880168872420969808_f32;
|
||||
|
||||
/// 1.0/sqrt(2.0)
|
||||
/// 1/sqrt(2)
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub const FRAC_1_SQRT_2: f32 = 0.707106781186547524400844362104849039_f32;
|
||||
|
||||
/// Euler's number
|
||||
/// Euler's number (e)
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub const E: f32 = 2.71828182845904523536028747135266250_f32;
|
||||
|
||||
/// log2(e)
|
||||
/// log<sub>2</sub>(e)
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub const LOG2_E: f32 = 1.44269504088896340735992468100189214_f32;
|
||||
|
||||
/// log10(e)
|
||||
/// log<sub>10</sub>(e)
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub const LOG10_E: f32 = 0.434294481903251827651128918916605082_f32;
|
||||
|
||||
/// ln(2.0)
|
||||
/// ln(2)
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub const LN_2: f32 = 0.693147180559945309417232121458176568_f32;
|
||||
|
||||
/// ln(10.0)
|
||||
/// ln(10)
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub const LN_10: f32 = 2.30258509299404568401799145468436421_f32;
|
||||
}
|
||||
|
|
|
@ -20,53 +20,53 @@ use mem;
|
|||
use num::FpCategory as Fp;
|
||||
use num::Float;
|
||||
|
||||
/// The radix or base of the internal representation of `f64`.
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[allow(missing_docs)]
|
||||
pub const RADIX: u32 = 2;
|
||||
|
||||
/// Number of significant digits in base 2.
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[allow(missing_docs)]
|
||||
pub const MANTISSA_DIGITS: u32 = 53;
|
||||
/// Approximate number of significant digits in base 10.
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[allow(missing_docs)]
|
||||
pub const DIGITS: u32 = 15;
|
||||
|
||||
/// Difference between `1.0` and the next largest representable number.
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[allow(missing_docs)]
|
||||
pub const EPSILON: f64 = 2.2204460492503131e-16_f64;
|
||||
|
||||
/// Smallest finite f64 value
|
||||
/// Smallest finite `f64` value.
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub const MIN: f64 = -1.7976931348623157e+308_f64;
|
||||
/// Smallest positive, normalized f64 value
|
||||
/// Smallest positive normal `f64` value.
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub const MIN_POSITIVE: f64 = 2.2250738585072014e-308_f64;
|
||||
/// Largest finite f64 value
|
||||
/// Largest finite `f64` value.
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub const MAX: f64 = 1.7976931348623157e+308_f64;
|
||||
|
||||
/// One greater than the minimum possible normal power of 2 exponent.
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[allow(missing_docs)]
|
||||
pub const MIN_EXP: i32 = -1021;
|
||||
/// Maximum possible power of 2 exponent.
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[allow(missing_docs)]
|
||||
pub const MAX_EXP: i32 = 1024;
|
||||
|
||||
/// Minimum possible normal power of 10 exponent.
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[allow(missing_docs)]
|
||||
pub const MIN_10_EXP: i32 = -307;
|
||||
/// Maximum possible power of 10 exponent.
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[allow(missing_docs)]
|
||||
pub const MAX_10_EXP: i32 = 308;
|
||||
|
||||
/// Not a Number (NaN).
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[allow(missing_docs)]
|
||||
pub const NAN: f64 = 0.0_f64/0.0_f64;
|
||||
/// Infinity (∞).
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[allow(missing_docs)]
|
||||
pub const INFINITY: f64 = 1.0_f64/0.0_f64;
|
||||
/// Negative infinity (-∞).
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[allow(missing_docs)]
|
||||
pub const NEG_INFINITY: f64 = -1.0_f64/0.0_f64;
|
||||
|
||||
/// Basic mathematical constants.
|
||||
|
@ -74,67 +74,67 @@ pub const NEG_INFINITY: f64 = -1.0_f64/0.0_f64;
|
|||
pub mod consts {
|
||||
// FIXME: replace with mathematical constants from cmath.
|
||||
|
||||
/// Archimedes' constant
|
||||
/// Archimedes' constant (π)
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub const PI: f64 = 3.14159265358979323846264338327950288_f64;
|
||||
|
||||
/// pi/2.0
|
||||
/// π/2
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub const FRAC_PI_2: f64 = 1.57079632679489661923132169163975144_f64;
|
||||
|
||||
/// pi/3.0
|
||||
/// π/3
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub const FRAC_PI_3: f64 = 1.04719755119659774615421446109316763_f64;
|
||||
|
||||
/// pi/4.0
|
||||
/// π/4
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub const FRAC_PI_4: f64 = 0.785398163397448309615660845819875721_f64;
|
||||
|
||||
/// pi/6.0
|
||||
/// π/6
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub const FRAC_PI_6: f64 = 0.52359877559829887307710723054658381_f64;
|
||||
|
||||
/// pi/8.0
|
||||
/// π/8
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub const FRAC_PI_8: f64 = 0.39269908169872415480783042290993786_f64;
|
||||
|
||||
/// 1.0/pi
|
||||
/// 1/π
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub const FRAC_1_PI: f64 = 0.318309886183790671537767526745028724_f64;
|
||||
|
||||
/// 2.0/pi
|
||||
/// 2/π
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub const FRAC_2_PI: f64 = 0.636619772367581343075535053490057448_f64;
|
||||
|
||||
/// 2.0/sqrt(pi)
|
||||
/// 2/sqrt(π)
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub const FRAC_2_SQRT_PI: f64 = 1.12837916709551257389615890312154517_f64;
|
||||
|
||||
/// sqrt(2.0)
|
||||
/// sqrt(2)
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub const SQRT_2: f64 = 1.41421356237309504880168872420969808_f64;
|
||||
|
||||
/// 1.0/sqrt(2.0)
|
||||
/// 1/sqrt(2)
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub const FRAC_1_SQRT_2: f64 = 0.707106781186547524400844362104849039_f64;
|
||||
|
||||
/// Euler's number
|
||||
/// Euler's number (e)
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub const E: f64 = 2.71828182845904523536028747135266250_f64;
|
||||
|
||||
/// log2(e)
|
||||
/// log<sub>2</sub>(e)
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub const LOG2_E: f64 = 1.44269504088896340735992468100189214_f64;
|
||||
|
||||
/// log10(e)
|
||||
/// log<sub>10</sub>(e)
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub const LOG10_E: f64 = 0.434294481903251827651128918916605082_f64;
|
||||
|
||||
/// ln(2.0)
|
||||
/// ln(2)
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub const LN_2: f64 = 0.693147180559945309417232121458176568_f64;
|
||||
|
||||
/// ln(10.0)
|
||||
/// ln(10)
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub const LN_10: f64 = 2.30258509299404568401799145468436421_f64;
|
||||
}
|
||||
|
|
|
@ -12,11 +12,11 @@
|
|||
|
||||
macro_rules! int_module { ($T:ident, $bits:expr) => (
|
||||
|
||||
/// The smallest value that can be represented by this integer type.
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[allow(missing_docs)]
|
||||
pub const MIN: $T = $T::min_value();
|
||||
/// The largest value that can be represented by this integer type.
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[allow(missing_docs)]
|
||||
pub const MAX: $T = $T::max_value();
|
||||
|
||||
) }
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
//! Numeric traits and functions for the built-in numeric types.
|
||||
|
||||
#![stable(feature = "rust1", since = "1.0.0")]
|
||||
#![allow(missing_docs)]
|
||||
|
||||
use char::CharExt;
|
||||
use cmp::PartialOrd;
|
||||
|
|
|
@ -12,11 +12,11 @@
|
|||
|
||||
macro_rules! uint_module { ($T:ident, $bits:expr) => (
|
||||
|
||||
/// The smallest value that can be represented by this integer type.
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[allow(missing_docs)]
|
||||
pub const MIN: $T = $T::min_value();
|
||||
/// The largest value that can be represented by this integer type.
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[allow(missing_docs)]
|
||||
pub const MAX: $T = $T::max_value();
|
||||
|
||||
) }
|
||||
|
|
Loading…
Add table
Reference in a new issue