Skip to content

Commit 2f8d9a2

Browse files
committed
Add NAN test to docs
1 parent 9c499cc commit 2f8d9a2

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

src/libstd/f32.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -970,6 +970,7 @@ impl f32 {
970970
/// assert!((-3.0f32).clamp(-2.0f32, 1.0f32) == -2.0f32);
971971
/// assert!((0.0f32).clamp(-2.0f32, 1.0f32) == 0.0f32);
972972
/// assert!((2.0f32).clamp(-2.0f32, 1.0f32) == 1.0f32);
973+
/// assert!((std::f32::NAN).clamp(-2.0f32, 1.0f32).is_nan());
973974
/// ```
974975
#[unstable(feature = "clamp", issue = "44095")]
975976
#[inline]

src/libstd/f64.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -892,6 +892,7 @@ impl f64 {
892892
/// assert!((-3.0f64).clamp(-2.0f64, 1.0f64) == -2.0f64);
893893
/// assert!((0.0f64).clamp(-2.0f64, 1.0f64) == 0.0f64);
894894
/// assert!((2.0f64).clamp(-2.0f64, 1.0f64) == 1.0f64);
895+
/// assert!((std::f64::NAN).clamp(-2.0f32, 1.0f32).is_nan());
895896
/// ```
896897
#[unstable(feature = "clamp", issue = "44095")]
897898
#[inline]

0 commit comments

Comments
 (0)