Why is the return type of powermod
always a Union{Int64, Int128, BigInt}
? As a consequence the following simple code is type-unstable:
julia> function f(a, b, c)
a = powermod(a, b, c)
a % 2 - a
end
julia> @code_warntype f(3, 4, 5)
MethodInstance for f(::Int64, ::Int64, ::Int64)
from f(a, b, c) @ Main REPL[16]:1
Arguments
#self#::Core.Const(f)
a@_2::Int64
b::Int64
c::Int64
Locals
a@_5::Union{Int128, Int64, BigInt}
Body::Any
1 β (a@_5 = a@_2)
β (a@_5 = Main.powermod(a@_5::Int64, b, c))
β %3 = (a@_5 % 2)::Union{Int128, Int64, BigInt}
β %4 = (%3 - a@_5)::Any
βββ return %4
Is it to account for overflowing?