Base NaN-compliant functions on NaNMath
This commit is contained in:
parent
74ad9fb880
commit
68adaf39ec
@ -106,12 +106,17 @@ export
|
|||||||
|
|
||||||
# ---------------------------------------------------------
|
# ---------------------------------------------------------
|
||||||
|
|
||||||
|
import NaNMath
|
||||||
# define functions (e.g. `_extrema`, that ignores NaNs, when the type is applicable. To overcome the destructive effects of https://github.com/JuliaLang/julia/pull/12563
|
# define functions (e.g. `_extrema`, that ignores NaNs, when the type is applicable. To overcome the destructive effects of https://github.com/JuliaLang/julia/pull/12563
|
||||||
for fun in (:extrema, :minimum, :maximum)
|
for fun in (:extrema, :minimum, :maximum)
|
||||||
@eval $(Symbol(string("_",fun))){F<:AbstractFloat}(x::AbstractArray{F}) = Base.$(fun)(filter(!isnan,x))
|
@eval $(Symbol(string("_",fun))){F<:AbstractFloat}(x::AbstractArray{F}) = NaNMath.$(fun)(x)
|
||||||
@eval $(Symbol(string("_",fun)))(x) = Base.$(fun)(x)
|
@eval $(Symbol(string("_",fun)))(x) = Base.$(fun)(x)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
for fun in (:min, :max)
|
||||||
|
@eval $(Symbol(string("_",fun))){F<:AbstractFloat}(x::F, y::F) = NaNMath.$(fun)(x)
|
||||||
|
@eval $(Symbol(string("_",fun)))(x...) = Base.$(fun)(x...)
|
||||||
|
end
|
||||||
# ---------------------------------------------------------
|
# ---------------------------------------------------------
|
||||||
|
|
||||||
import Measures
|
import Measures
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user