Skip to content

Commit

Permalink
Merge pull request #660 from JuliaIntervals/dps-exact-real-constructor
Browse files Browse the repository at this point in the history
Remove inner constructor for ExactReal
  • Loading branch information
Kolaru authored May 29, 2024
2 parents 685efc3 + 141e0c8 commit 0bb1d9b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/intervals/exact_literals.jl
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ See also: [`@exact`](@ref).
struct ExactReal{T<:Real} <: Real
value :: T

ExactReal{T}(value::T) where {T<:Real} = new{T}(value)
ExactReal(value::T) where {T<:Real} = new{T}(value)
end

Expand Down
3 changes: 3 additions & 0 deletions test/interval_tests/exact_literals.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
@test (@exact 1.2 + 3.4im) isa Complex{<:ExactReal}
@test_throws ArgumentError (@exact 1.2 + 3im)

@test ExactReal{Int}(3).value == 3
@test_throws MethodError ExactReal{Float64}(1//3)

#

x = @exact 0.5
Expand Down

0 comments on commit 0bb1d9b

Please sign in to comment.