I found that it’s --math-mode=fast makes them crazy:
julia> @enter isfinite(NaN)
[ Info: tracking Base
In isfinite(x) at float.jl:554
>554 isfinite(x::AbstractFloat) = x - x == 0
About to run: (-)(0.0, 0.0)
from the above, I see that NaN is indeed passed as 0.0 into isfinite() !
is it the expected behavior when --math-mode=fast? thanks.
" Use @fastmath to allow floating point optimizations that are correct for real numbers, but lead to differences for IEEE numbers." Performance Tips · The Julia Language. By “IEEE Numbers”, this is explicitly calling out things like -0.0NaN and Inf
EDIT: the Julia documentation mentions that @fastmath corresponds to the fast-math option of clang which in its documentation is pretty clear about NaN and +-Inf as well:
Allow floating-point optimizations that assume arguments and results are not NaNs or ±Inf.