You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
julia> a = 1//1..2//1
[1//1, 2//1]
julia> b = 0//1..2//1
[0//1, 2//1]
julia> a/b
ERROR: MethodError: no method matching Rational{Int64}(::Float64, ::RoundingMode{:Up})
Closest candidates are:
Rational{T}(::AbstractFloat) where T<:Integer at rational.jl:118
(::Type{T})(::T) where T<:Number at boot.jl:760
Stacktrace:
[1] /(a::Interval{Rational{Int64}}, b::Interval{Rational{Int64}})
@ IntervalArithmetic C:\Users\lucaa\.julia\dev\IntervalArithmetic\src\intervals\arithmetic.jl:199
[2] top-level scope
@ REPL[146]:1
julia> (-1//0..1//1) + (-1//0..1//1)
ERROR: DivideError: integer division error
Stacktrace:
[1] div
@ .\int.jl:261 [inlined]
[2] divgcd
@ .\rational.jl:44 [inlined]
[3] +(x::Rational{Int64}, y::Rational{Int64})
@ Base .\rational.jl:284
[4] +
@ C:\Users\lucaa\.julia\dev\IntervalArithmetic\src\intervals\rounding.jl:82 [inlined]
[5] +(a::Interval{Rational{Int64}}, b::Interval{Rational{Int64}})
@ IntervalArithmetic C:\Users\lucaa\.julia\dev\IntervalArithmetic\src\intervals\arithmetic.jl:86
[6] top-level scope
@ REPL[148]:1
For division, I think the issue stems in the round_expr function, I think for rationals the fallback method that does nothing should be called, but this does not seem to be the case (might be wrong)
For addition, the issue is not really in IntervalArithmetic, because
I guess hard coding the arithmetic operations for intervals of rationals and manually taking care of those corner cases would work, it shouldn't be hard since with rationals there are no rounding issues. Maybe not a super elegant solution though.
The text was updated successfully, but these errors were encountered:
Also, there are some operations (like those supposed to return NaN, e.g. midpoint of empty interval) cannot work (at least in a type stable manner) since rationals don't have a way to represent NaN
I found these issues while fixing #466 ,
For division, I think the issue stems in the round_expr function, I think for rationals the fallback method that does nothing should be called, but this does not seem to be the case (might be wrong)
For addition, the issue is not really in IntervalArithmetic, because
I guess hard coding the arithmetic operations for intervals of rationals and manually taking care of those corner cases would work, it shouldn't be hard since with rationals there are no rounding issues. Maybe not a super elegant solution though.
The text was updated successfully, but these errors were encountered: