@fastmath
doesn’t just set compiler flags; the ninf
, nnan
, and afn
flags are (mostly?) implemented in Julia, replacing Julia-native functions like sin
and exp
with Julia-native equivalents like sin_fast
and exp_fast
. See the full list at julia/base/fastmath.jl at 0fade450a183470b01c656a9001512ef2f1aae47 · JuliaLang/julia · GitHub.
For the most part, the implementations only differ for complex numbers, but you also have things like hypot_fast(x, y) = sqrt(x * x + y * y)
, i.e., throwing caution about over/underflow to the wind, which I guess makes sense next to isinf_fast(x) = false
and issubnormal_fast(x) = false
.