Skip to content

Commit

Permalink
Fix f64 examples
Browse files Browse the repository at this point in the history
  • Loading branch information
Xaeroxe committed Aug 26, 2017
1 parent 61f20f8 commit 576426a
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/libstd/f64.rs
Expand Up @@ -971,15 +971,17 @@ impl f64 {
}

/// Returns max if self is greater than max, and min if self is less than min.
/// Otherwise this returns self. Panics if min > max, min equals NaN, or max equals NaN.
/// Otherwise this returns self. Panics if min > max, min is NaN, or max is NaN.
///
/// # Examples
///
/// ```
/// #![feature(clamp)]
/// use std::f64::NAN;
/// assert!((-3.0f64).clamp(-2.0f64, 1.0f64) == -2.0f64);
/// assert!((0.0f64).clamp(-2.0f64, 1.0f64) == 0.0f64);
/// assert!((2.0f64).clamp(-2.0f64, 1.0f64) == 1.0f64);
/// assert!((NAN).clamp(-2.0f64, 1.0f64) == NAN);
/// assert!((NAN).clamp(-2.0f64, 1.0f64).is_nan());
/// ```
#[unstable(feature = "clamp", issue = "44095")]
#[inline]
Expand Down

0 comments on commit 576426a

Please sign in to comment.