From its name, I would guess it computes the same thing as
abs(z::Complex) but faster. However
julia> z = 3 + 4im 3 + 4im julia> abs(z) 5.0 julia> Base.Math.fastabs(z) 7
Looking at the code, the definition is
""" fastabs(x::Number) Faster `abs`-like function for rough magnitude comparisons. `fastabs` is equivalent to `abs(x)` for most `x`, but for complex `x` it computes `abs(real(x))+abs(imag(x))` rather than requiring `hypot`. """ fastabs(x::Number) = abs(x) fastabs(z::Complex) = abs(real(z)) + abs(imag(z))
What is this function used for?
I thought this was a bug and opened an issue and was told that there is some “intended behaviour”… what is the used case? It’s confusing when it says
Faster abs-like function for rough magnitude comparisons.
while 5 and 7 seems to be a pretty big difference…