Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

extrema(x;dims::Int) behavior with NaN #43599

Closed
mikmoore opened this issue Dec 30, 2021 · 2 comments · Fixed by #43604
Closed

extrema(x;dims::Int) behavior with NaN #43599

mikmoore opened this issue Dec 30, 2021 · 2 comments · Fixed by #43604
Labels
bug Indicates an unexpected problem or unintended behavior

Comments

@mikmoore
Copy link
Contributor

https://discourse.julialang.org/t/extrema-x-dims-1-and-nans/73764

julia> extrema([1 NaN; NaN 1],dims=1)
1×2 Matrix{Tuple{Float64, Float64}}:
 (1.0, 1.0)  (NaN, NaN)

The NaNs are ignored except when they appear in the leading position. This behavior deviates from that of minimum/maximum.
There is no issue with dims=:, which is the default, since that routes through the generic iterator method rather than the per-dimension method.

Tangentially related to #35308, but I'm filing a new issue since the manifestations are different and the fixes might be, too.

@oscardssmith oscardssmith added the bug Indicates an unexpected problem or unintended behavior label Dec 30, 2021
N5N3 added a commit to N5N3/julia that referenced this issue Dec 30, 2021
@StefanPofahl
Copy link

The issue does still exist.

@martinholters
Copy link
Member

Looks fixed to me:

julia> VERSION
v"1.9.0"

julia> extrema([1 NaN; NaN 1],dims=1)
1×2 Matrix{Tuple{Float64, Float64}}:
 (NaN, NaN)  (NaN, NaN)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Indicates an unexpected problem or unintended behavior
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants