Strange inconsistent in complex algebra

Yes, possibly a signless strong zero would make sense for your use case:

struct SignEater <: Real end
Base.:*(::SignEater, ::T) where {T <: Real} = zero(T)
Base.:*(::SignEater, ::Complex{T}) where {T <: Real} = Complex(zero(T),zero(T))
# NOTE: more methods are needed for ambiguities and I did not do that carefully
const 𝟎 = SignEater()
𝟎 * -Inf # 0.0
𝟎 * 1im  # 0 + 0im

(Incidentally, please post quoted code, not screenshots).

1 Like