File tree 1 file changed +4
-2
lines changed
1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -971,15 +971,17 @@ impl f64 {
971
971
}
972
972
973
973
/// Returns max if self is greater than max, and min if self is less than min.
974
- /// Otherwise this returns self. Panics if min > max, min equals NaN, or max equals NaN.
974
+ /// Otherwise this returns self. Panics if min > max, min is NaN, or max is NaN.
975
975
///
976
976
/// # Examples
977
977
///
978
978
/// ```
979
+ /// #![feature(clamp)]
980
+ /// use std::f64::NAN;
979
981
/// assert!((-3.0f64).clamp(-2.0f64, 1.0f64) == -2.0f64);
980
982
/// assert!((0.0f64).clamp(-2.0f64, 1.0f64) == 0.0f64);
981
983
/// assert!((2.0f64).clamp(-2.0f64, 1.0f64) == 1.0f64);
982
- /// assert!((NAN).clamp(-2.0f64, 1.0f64) == NAN );
984
+ /// assert!((NAN).clamp(-2.0f64, 1.0f64).is_nan() );
983
985
/// ```
984
986
#[ unstable( feature = "clamp" , issue = "44095" ) ]
985
987
#[ inline]
You can’t perform that action at this time.
0 commit comments