diff --git a/src/math.jl b/src/math.jl index 3dd6730c..7b3b3814 100644 --- a/src/math.jl +++ b/src/math.jl @@ -715,6 +715,9 @@ Base.nextfloat(a::Measurement, n::Integer) = result(nextfloat(a.val, n), 1, a) Base.maxintfloat(::Type{Measurement{T}}) where {T<:AbstractFloat} = maxintfloat(T) +Base.floatmin(::Type{Measurement{T}}) where {T<:AbstractFloat} = floatmin(T) ± zero(T) +Base.floatmax(::Type{Measurement{T}}) where {T<:AbstractFloat} = floatmax(T) ± zero(T) + Base.typemax(::Type{Measurement{T}}) where {T<:AbstractFloat} = typemax(T) ### Rounding diff --git a/test/runtests.jl b/test/runtests.jl index c076500d..bddc3806 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -533,13 +533,15 @@ end end end -@testset "Machine precisionx" begin +@testset "Machine precision" begin @test eps(Measurement{Float64}) ≈ eps(Float64) @test eps(x) ≈ eps(x.val) @test nextfloat(x) ≈ nextfloat(x.val) ± x.err @test nextfloat(x, 3) ≈ nextfloat(x.val, 3) ± x.err @test prevfloat(w) ≈ prevfloat(w.val) ± w.err @test prevfloat(y, 3) ≈ prevfloat(y.val, 3) ± y.err + @test floatmin(Measurement{Float64}) ≈ floatmin(Float64) ± zero(Float64) + @test floatmax(Measurement{Float64}) ≈ floatmax(Float64) ± zero(Float64) @test maxintfloat(Measurement{Float64}) ≈ maxintfloat(Float64) end