-
Notifications
You must be signed in to change notification settings - Fork 28
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
Functions not compatible with all Base-compatible types #17
Comments
I'll likely accept a PR generalizing the implementations so long as they remain reasonably simple or copies of what is in Base with slight modification. |
Would it be out of the question to simply import the Base functions here (silencing the warnings)? In that case I should think all non-Vector{AbstractFloat} calls (which can't have NaNs) will just fall back on the Base methods. I may be missing some complexity here, of course. |
Yes, because if we do that then the implementations in |
Right :-/ |
We're exploring a local solution along the lines of: import NaNMath
_extrema(x...) = Base.extrema(x...)
_extrema(x::AbstractVector{<:AbstractFloat}) = NaNMath.extrema(x) |
Since the functions in
Also, it would be great to define the other forms of the function inside
This way if someone replaces |
Well then sometimes the method ignores NaNs and sometimes it doesn't. I'd rather have a method error than a surprising behavior like that. |
I thought that only subtypes of |
That's a reasonable argument. I would consider a PR. |
OK. I'll try to put something together in the next few weeks. |
Note that I had a PR implementing this based on exactly this assumption (#21), but it was closed because the assumption isn't strictly true. Tuples can hold NaN s as welll (see the discussion on the PR). I'd still welcome this change, though. |
We've tried replacing
Base.maximum
withNaNMath.maximum
in Plots, as we very often deal withVector
s withNaN
s in them.NaN
s are e.g. used as placeholders for breaks in line segments.However, this causes the package to fail, as sometimes maximum will be called on something that is not a
Vector{AbstractFloat}
:AFAICS we cannot guarantee in advance what type gets passed to
maximum
. Is there a workaround for this?The text was updated successfully, but these errors were encountered: