diff --git a/src/intervals/exact_literals.jl b/src/intervals/exact_literals.jl index 20e204a51..6cf65198c 100644 --- a/src/intervals/exact_literals.jl +++ b/src/intervals/exact_literals.jl @@ -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 diff --git a/test/interval_tests/exact_literals.jl b/test/interval_tests/exact_literals.jl index 36875d015..b64b6666d 100644 --- a/test/interval_tests/exact_literals.jl +++ b/test/interval_tests/exact_literals.jl @@ -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