Skip to content

Commit 399b5eb

Browse files
committed
explain mysterious addition in float minimum/maximum
1 parent af78bae commit 399b5eb

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

library/core/src/num/f32.rs

+1
Original file line numberDiff line numberDiff line change
@@ -957,6 +957,7 @@ impl f32 {
957957
} else if self == other {
958958
if self.is_sign_negative() && other.is_sign_positive() { self } else { other }
959959
} else {
960+
// Both inputs are NaN. Use `+` to perform NaN propagation.
960961
self + other
961962
}
962963
}

library/core/src/num/f64.rs

+1
Original file line numberDiff line numberDiff line change
@@ -968,6 +968,7 @@ impl f64 {
968968
} else if self == other {
969969
if self.is_sign_negative() && other.is_sign_positive() { self } else { other }
970970
} else {
971+
// Both inputs are NaN. Use `+` to perform NaN propagation.
971972
self + other
972973
}
973974
}

0 commit comments

Comments
 (0)