Skip to content

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

@mikmoore

Description

@mikmoore

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIndicates an unexpected problem or unintended behavior

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions