Closed Moelf closed 4 years ago
Seems safe enough. Be careful about division by zero when count = 0.
that's how we recover the NaN
if all elements are NaN
actually.
Is it guaranteed that any AbstractFloat
defines 0.0/0 = NaN?
julia> for T in subtypes(AbstractFloat)
@assert isnan(zero(T)/0)
end
I think so. Because it first promote 0
to the float 0.0 of type T
this runs 2x faster (on an AMD cpu, so this is expected). Is this a reasonable update(?) to what we already have?