@@ -21,19 +21,34 @@ pub(crate) enum MinMax {
2121/// readability.
2222///
2323/// ## Example
24+ ///
2425/// ```python
2526/// minimum = min(1, 2, min(3, 4, 5))
2627/// maximum = max(1, 2, max(3, 4, 5))
2728/// diff = maximum - minimum
2829/// ```
2930///
3031/// Use instead:
32+ ///
3133/// ```python
3234/// minimum = min(1, 2, 3, 4, 5)
3335/// maximum = max(1, 2, 3, 4, 5)
3436/// diff = maximum - minimum
3537/// ```
3638///
39+ /// ## Fix safety
40+ ///
41+ /// This fix is always unsafe and may change the program's behavior for types without full
42+ /// equivalence relations, such as float comparisons involving `NaN`.
43+ ///
44+ /// ```python
45+ /// print(min(2.0, min(float("nan"), 1.0))) # before fix: 2.0
46+ /// print(min(2.0, float("nan"), 1.0)) # after fix: 1.0
47+ ///
48+ /// print(max(1.0, max(float("nan"), 2.0))) # before fix: 1.0
49+ /// print(max(1.0, float("nan"), 2.0)) # after fix: 2.0
50+ /// ```
51+ ///
3752/// ## References
3853/// - [Python documentation: `min`](https://docs.python.org/3/library/functions.html#min)
3954/// - [Python documentation: `max`](https://docs.python.org/3/library/functions.html#max)
0 commit comments