Repository navigation
Commit b9903ea
Fix inverted is_all_nan / is_any_nan / is_all_infinite / is_any_infinite
The boolean_ops! macro in src/numeric/impl_float_maths.rs had an inverted $all
predicate: Zip::from(self).all(|&elt| !elt.$func()) tests "all elements are NOT
NaN", the opposite of the documented "true if all elements are NaN". $any was
defined as !self.$all(), so the double negation made is_any_* appear correct
while is_all_* returned true for an all-finite array.
Correct both predicates together (fixing only $all would break the is_any_*
methods that ride on the double negation):
$all -> Zip::from(self).all(|&elt| elt.$func())
$any -> Zip::from(self).any(|&elt| elt.$func())
Empty-array semantics are preserved (all -> true, any -> false).
Fixes #16121 parent c95d814 commit b9903ea
2 files changed
Lines changed: 49 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
| 23 | + | |
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
28 | | - | |
| 28 | + | |
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
0 commit comments