-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Fix minimum and maximum in the presence of missing values #35989
Conversation
base/reduce.jl
Outdated
v2 == v2 || return v2 | ||
v3 == v3 || return v3 | ||
v4 == v4 || return v4 | ||
# === true is there to ignore missing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"ignore" isn't the right term actually since we short-circuit. I can change this to just add "or missing" to the existing comment for NaN.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just say something like "to handle missing"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually "short-circuit" is even more accurate I think.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
…35989) * Fix minimum and maximum in the presence of missing values * Fix comment
Another, possibly cleaner way of fixing this would be to add an
isnan(::Number) = false
fallback, and dox isa Number && isnan(x)
. That would make the code a bit clearer and could be useful for others. Currently we would have to dox isa Union{Real, Complex} && isnan(x)
since there are the only types for which we defineisnan
methods -- but that approach wouldn't work for custom complex types.Similar to #35323 (but simpler to fix).