MWE:
julia> struct MyNumber
value::Float64
end
julia> Base.:^(x::MyNumber,n::Int) = MyNumber(x.value^n)
julia> @which x^-1
^(x::MyNumber, n::Int64) in Main at REPL[2]:1
julia> x = MyNumber(rand())
MyNumber(0.9658905866711973)
julia> x^-1
ERROR: MethodError: no method matching inv(::MyNumber)
Closest candidates are:
inv(::Complex{Float64}) at complex.jl:431
inv(::BigFloat) at mpfr.jl:471
inv(::Integer) at int.jl:56
It should not be calling inv(::MyNumber)
, right?