julia> clamp(typemax(UInt64), Int64)
ERROR: InexactError: check_top_bit(UInt64, -9223372036854775808)
Stacktrace:
[1] throw_inexacterror(f::Symbol, ::Type{UInt64}, val::Int64)
@ Core ./boot.jl:634
[2] check_top_bit
@ ./boot.jl:648 [inlined]
[3] toUInt64
@ ./boot.jl:759 [inlined]
[4] UInt64
@ ./boot.jl:789 [inlined]
[5] convert
@ ./number.jl:7 [inlined]
[6] clamp
@ ./math.jl:98 [inlined]
[7] clamp(x::UInt64, ::Type{Int64})
@ Base.Math ./math.jl:123
[8] top-level scope
@ REPL[1]:1
The call
clamp(typemax(UInt64), Int64)should returntypemax(Int64)but throwsInexactError.