Skip to content

Commit

Permalink
Support Rational - Int operations (#429)
Browse files Browse the repository at this point in the history
* Support rational-int operations and add test

* use interval instead of @interval
  • Loading branch information
rushabh-v committed Dec 9, 2020
1 parent 4d0eba5 commit abd2a9a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/intervals/conversion.jl
Original file line number Diff line number Diff line change
Expand Up @@ -150,3 +150,6 @@ atomic(::Type{Interval{Rational{T}}}, x::S) where {T<:Integer, S<:Float64} =

atomic(::Type{Interval{Rational{T}}}, x::S) where {T<:Integer, S<:BigFloat} =
Interval(rationalize(T, x))

atomic(::Type{Interval{Rational{T}}}, x::Interval{Rational{T}}) where {T<:Integer} =
Interval(x)
1 change: 1 addition & 0 deletions test/interval_tests/numeric.jl
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@ end
g = 1 // 3

@test @interval(f*g) == Interval(1.1111111111111109e-01, 1.1111111111111115e-01)
@test interval(f, g) - 1 == interval(-2 // 3, -2 // 3)
@test big(1.)/9 @interval(f*g)
@test @interval(1)/9 @interval(f*g)
@test @interval(1)/9 @interval(f*g)
Expand Down

2 comments on commit abd2a9a

@dpsanders
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Error while trying to register: "Tag with name v0.17.5 already exists and points to a different commit"

Please sign in to comment.