Open
Description
julia> import MutableArithmetics
julia> f(op::F, ::Type{T}) where {F, T} = MutableArithmetics.mutability(T, op, T, T)
f (generic function with 1 method)
julia> f(/, BigInt)
MutableArithmetics.IsNotMutable()
julia> f(div, BigInt)
MutableArithmetics.IsMutable()
julia> f(/, Rational{BigInt})
MutableArithmetics.IsMutable()
julia> f(div, Rational{BigInt})
ERROR: DivideError: integer division error
Stacktrace:
[1] tdiv_q!(x::BigInt, a::BigInt, b::BigInt)
@ Base.GMP.MPZ ./gmp.jl:165
[2] tdiv_q
@ ./gmp.jl:166 [inlined]
[3] div
@ ./gmp.jl:508 [inlined]
[4] div
@ ./gmp.jl:512 [inlined]
[5] divgcd(x::BigInt, y::BigInt)
@ Base ./rational.jl:43
[6] div(x::Rational{BigInt}, y::Rational{BigInt}, r::RoundingMode{:ToZero})
@ Base ./rational.jl:481
[7] div
@ Base ./rational.jl:488 [inlined]
[8] div
@ Base ./rational.jl:492 [inlined]
[9] promote_operation_fallback
@ MutableArithmetics ~/tmp/jl/MutableArithmetics.jl/src/interface.jl:51 [inlined]
[10] promote_operation
@ MutableArithmetics ~/tmp/jl/MutableArithmetics.jl/src/interface.jl:113 [inlined]
[11] mutability
@ MutableArithmetics ~/tmp/jl/MutableArithmetics.jl/src/interface.jl:266 [inlined]
[12] f(op::typeof(div), ::Type{Rational{BigInt}})
@ Main ./REPL[2]:1
[13] top-level scope
@ REPL[6]:1
(@v1.11) pkg> st MutableArithmetics
Status `~/.julia/environments/v1.11/Project.toml`
[d8a4904e] MutableArithmetics v1.3.3 `~/tmp/jl/MutableArithmetics.jl`
Metadata
Metadata
Assignees
Labels
No labels