Update float documentation to use associated consts

This commit is contained in:
Linus Färnstrand 2020-02-04 23:08:59 +01:00
parent 086927480b
commit 83191c2da6
2 changed files with 2 additions and 22 deletions

View file

@ -213,8 +213,6 @@ impl f32 {
/// Returns `true` if this value is `NaN`.
///
/// ```
/// use std::f32;
///
/// let nan = f32::NAN;
/// let f = 7.0_f32;
///
@ -239,8 +237,6 @@ impl f32 {
/// `false` otherwise.
///
/// ```
/// use std::f32;
///
/// let f = 7.0f32;
/// let inf = f32::INFINITY;
/// let neg_inf = f32::NEG_INFINITY;
@ -261,8 +257,6 @@ impl f32 {
/// Returns `true` if this number is neither infinite nor `NaN`.
///
/// ```
/// use std::f32;
///
/// let f = 7.0f32;
/// let inf = f32::INFINITY;
/// let neg_inf = f32::NEG_INFINITY;
@ -286,8 +280,6 @@ impl f32 {
/// [subnormal], or `NaN`.
///
/// ```
/// use std::f32;
///
/// let min = f32::MIN_POSITIVE; // 1.17549435e-38f32
/// let max = f32::MAX;
/// let lower_than_min = 1.0e-40_f32;
@ -315,7 +307,6 @@ impl f32 {
///
/// ```
/// use std::num::FpCategory;
/// use std::f32;
///
/// let num = 12.4_f32;
/// let inf = f32::INFINITY;
@ -375,8 +366,6 @@ impl f32 {
/// Takes the reciprocal (inverse) of a number, `1/x`.
///
/// ```
/// use std::f32;
///
/// let x = 2.0_f32;
/// let abs_difference = (x.recip() - (1.0 / x)).abs();
///
@ -391,7 +380,7 @@ impl f32 {
/// Converts radians to degrees.
///
/// ```
/// use std::f32::{self, consts};
/// use std::f32::consts;
///
/// let angle = consts::PI;
///
@ -410,7 +399,7 @@ impl f32 {
/// Converts degrees to radians.
///
/// ```
/// use std::f32::{self, consts};
/// use std::f32::consts;
///
/// let angle = 180.0f32;
///

View file

@ -212,8 +212,6 @@ impl f64 {
/// Returns `true` if this value is `NaN`.
///
/// ```
/// use std::f64;
///
/// let nan = f64::NAN;
/// let f = 7.0_f64;
///
@ -238,8 +236,6 @@ impl f64 {
/// `false` otherwise.
///
/// ```
/// use std::f64;
///
/// let f = 7.0f64;
/// let inf = f64::INFINITY;
/// let neg_inf = f64::NEG_INFINITY;
@ -260,8 +256,6 @@ impl f64 {
/// Returns `true` if this number is neither infinite nor `NaN`.
///
/// ```
/// use std::f64;
///
/// let f = 7.0f64;
/// let inf: f64 = f64::INFINITY;
/// let neg_inf: f64 = f64::NEG_INFINITY;
@ -285,8 +279,6 @@ impl f64 {
/// [subnormal], or `NaN`.
///
/// ```
/// use std::f64;
///
/// let min = f64::MIN_POSITIVE; // 2.2250738585072014e-308f64
/// let max = f64::MAX;
/// let lower_than_min = 1.0e-308_f64;
@ -314,7 +306,6 @@ impl f64 {
///
/// ```
/// use std::num::FpCategory;
/// use std::f64;
///
/// let num = 12.4_f64;
/// let inf = f64::INFINITY;