Wrong result of min() and max() in nalgebra::base::min_max::Matrix when f64::NAN is included
- Dominant language
- Rust
- Stars
- 4.8k
- Forks
- 565
- PR merge metrics
- No merged PRs in 30d
Description
There seems to be a bug for the `min()` and `max()` methods of `nalgebra::base::min_max::Matrix` when an `f64::NAN` is included in the matrix.
Specifically, the entries before the `NAN`-entry are discarded when using these functions, which results in a wrong output.
For example in this simplified function:
```
fn main() {
let mat_wrong_min = MatrixXx1::from_vec(vec![-3., f64::NAN,-2.,-1.,0.]);
let mat_wrong_max = MatrixXx1::from_vec(vec![3., f64::NAN,2.,1.,0.]);
println!("min:\t{}", mat_wrong_min.min());
println!("min:\t{}", mat_wrong_max.max());
};
```
The first `println!` statement prints -2., instead of -3. and the second `println!` statement prints out 2. instead of 3.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.