File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change 7676# Fastest way to check for NaN in an array.
7777# Thanks @mikmore https://discourse.julialang.org/t/fastest-way-to-check-for-inf-or-nan-in-an-array/76954/33?u=milescranmer
7878is_bad_array (x) = ! is_good_array (x)
79- @generated function is_good_array (x)
80- Sys . iswindows () && return :( sum (xi -> xi * zero (xi), x) == zero (eltype (x) ))
81- return :( isempty (x) || vmapreduce (xi -> xi * zero (xi), + , x) == zero (eltype (x) ))
79+ function is_good_array (x)
80+ IS_WINDOWS && return sum (xi -> xi * zero (xi), x) == zero (eltype (x))
81+ return isempty (x) || vmapreduce (xi -> xi * zero (xi), + , x) == zero (eltype (x))
8282end
83+ const IS_WINDOWS = Sys. iswindows ()
8384
8485isgood (x:: T ) where {T<: Number } = ! (isnan (x) || ! isfinite (x))
8586isgood (x) = true
You can’t perform that action at this time.
0 commit comments