Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 10 additions & 8 deletions src/libstd/num/f32.rs
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ impl f32 {
/// // Values between `0` and `min` are Subnormal.
/// assert!(!lower_than_min.is_normal());
/// ```
/// [subnormal]: http://en.wikipedia.org/wiki/Denormal_number
/// [subnormal]: https://en.wikipedia.org/wiki/Denormal_number
#[stable(feature = "rust1", since = "1.0.0")]
#[inline]
pub fn is_normal(self) -> bool { num::Float::is_normal(self) }
Expand Down Expand Up @@ -923,12 +923,12 @@ impl f32 {
/// Computes the tangent of a number (in radians).
///
/// ```
/// use std::f64;
/// use std::f32;
///
/// let x = f64::consts::PI/4.0;
/// let x = f32::consts::PI / 4.0;
/// let abs_difference = (x.tan() - 1.0).abs();
///
/// assert!(abs_difference < 1e-10);
/// assert!(abs_difference <= f32::EPSILON);
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
#[inline]
Expand Down Expand Up @@ -1052,12 +1052,14 @@ impl f32 {
/// number is close to zero.
///
/// ```
/// let x = 7.0f64;
/// use std::f32;
///
/// // e^(ln(7)) - 1
/// let abs_difference = (x.ln().exp_m1() - 6.0).abs();
/// let x = 6.0f32;
///
/// assert!(abs_difference < 1e-10);
/// // e^(ln(6)) - 1
/// let abs_difference = (x.ln().exp_m1() - 5.0).abs();
///
/// assert!(abs_difference <= f32::EPSILON);
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
#[inline]
Expand Down
20 changes: 10 additions & 10 deletions src/libstd/num/f64.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,23 +147,23 @@ impl f64 {
/// [subnormal][subnormal], or `NaN`.
///
/// ```
/// use std::f32;
/// use std::f64;
///
/// let min = f32::MIN_POSITIVE; // 1.17549435e-38f64
/// let max = f32::MAX;
/// let lower_than_min = 1.0e-40_f32;
/// let zero = 0.0f32;
/// let min = f64::MIN_POSITIVE; // 2.2250738585072014e-308f64
/// let max = f64::MAX;
/// let lower_than_min = 1.0e-308_f64;
/// let zero = 0.0f64;
///
/// assert!(min.is_normal());
/// assert!(max.is_normal());
///
/// assert!(!zero.is_normal());
/// assert!(!f32::NAN.is_normal());
/// assert!(!f32::INFINITY.is_normal());
/// assert!(!f64::NAN.is_normal());
/// assert!(!f64::INFINITY.is_normal());
/// // Values between `0` and `min` are Subnormal.
/// assert!(!lower_than_min.is_normal());
/// ```
/// [subnormal]: http://en.wikipedia.org/wiki/Denormal_number
/// [subnormal]: https://en.wikipedia.org/wiki/Denormal_number
#[stable(feature = "rust1", since = "1.0.0")]
#[inline]
pub fn is_normal(self) -> bool { num::Float::is_normal(self) }
Expand Down Expand Up @@ -655,9 +655,9 @@ impl f64 {
/// ```
/// #![feature(float_extras)]
///
/// let x = 1.0f32;
/// let x = 1.0f64;
///
/// let abs_diff = (x.next_after(2.0) - 1.00000011920928955078125_f32).abs();
/// let abs_diff = (x.next_after(2.0) - 1.0000000000000002220446049250313_f64).abs();
///
/// assert!(abs_diff < 1e-10);
/// ```
Expand Down
6 changes: 0 additions & 6 deletions src/libstd/primitive_docs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -490,9 +490,6 @@ mod prim_tuple { }
///
/// *[See also the `std::f32` module](f32/index.html).*
///
/// However, please note that examples are shared between the `f64` and `f32`
/// primitive types. So it's normal if you see usage of `f64` in there.
///
mod prim_f32 { }

#[doc(primitive = "f64")]
Expand All @@ -501,9 +498,6 @@ mod prim_f32 { }
///
/// *[See also the `std::f64` module](f64/index.html).*
///
/// However, please note that examples are shared between the `f64` and `f32`
/// primitive types. So it's normal if you see usage of `f32` in there.
///
mod prim_f64 { }

#[doc(primitive = "i8")]
Expand Down