Promotion in comparison fails in exponentiation
jishnub opened this issue · 1 comments
jishnub commented
julia> SafeInt8(5)^SafeInt8(2)
ERROR: InexactError: trunc(Int8, 129)
Stacktrace:
[1] throw_inexacterror(f::Symbol, #unused#::Type{Int8}, val::Int64)
@ Core ./boot.jl:634
[2] checked_trunc_sint
@ ./boot.jl:656 [inlined]
[3] toInt8
@ ./boot.jl:671 [inlined]
[4] Int8
@ ./boot.jl:781 [inlined]
[5] SafeInt8
@ ~/.julia/packages/SaferIntegers/UJFmn/src/construct.jl:73 [inlined]
[6] convert(#unused#::Type{SafeInt8}, x::Int64)
@ Base ./number.jl:7
[7] _promote
@ ./promotion.jl:358 [inlined]
[8] promote
@ ./promotion.jl:381 [inlined]
[9] <
@ ~/.julia/packages/SaferIntegers/UJFmn/src/binary_ops.jl:42 [inlined]
[10] ^(x::SafeInt8, y::SafeInt8)
@ SaferIntegers ~/.julia/packages/SaferIntegers/UJFmn/src/pow.jl:22
[11] top-level scope
@ REPL[12]:1
The error seems to arise from
Line 22 in 4653835
because
julia> SafeInt8(5) < 129
ERROR: InexactError: trunc(Int8, 129)
Stacktrace:
[1] throw_inexacterror(f::Symbol, #unused#::Type{Int8}, val::Int64)
@ Core ./boot.jl:634
[2] checked_trunc_sint
@ ./boot.jl:656 [inlined]
[3] toInt8
@ ./boot.jl:671 [inlined]
[4] Int8
@ ./boot.jl:781 [inlined]
[5] SafeInt8
@ ~/.julia/packages/SaferIntegers/UJFmn/src/construct.jl:73 [inlined]
[6] convert
@ ./number.jl:7 [inlined]
[7] _promote
@ ./promotion.jl:358 [inlined]
[8] promote
@ ./promotion.jl:381 [inlined]
[9] <(x::SafeInt8, y::Int64)
@ SaferIntegers ~/.julia/packages/SaferIntegers/UJFmn/src/binary_ops.jl:42
[10] top-level scope
@ REPL[14]:1
JeffreySarnoff commented
Thank you. I believe this is now fixed in main, pending merge. Let me know if you find any other issues.