diff --git a/src/LogarithmicNumbers.jl b/src/LogarithmicNumbers.jl index 42902ce..b1f8190 100644 --- a/src/LogarithmicNumbers.jl +++ b/src/LogarithmicNumbers.jl @@ -328,6 +328,10 @@ function Base.isequal(x::Logarithmic, y::Logarithmic) isequal(x.abs, y.abs) && isequal(x.signbit, y.signbit) end +function Base.isapprox(x::ULogarithmic, y::ULogarithmic; kwargs...) + isapprox(Logarithmic(x), Logarithmic(y); kwargs...) +end + function Base.:(<)(x::ULogarithmic, y::ULogarithmic) x.log < y.log end diff --git a/test/runtests.jl b/test/runtests.jl index 4e2a53e..ee9561e 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -305,6 +305,16 @@ atypes2 = (ULogarithmic, ULogFloat32, Logarithmic, LogFloat32) end end + @testset "isapprox" begin + for A in atypes, x1 in vals + A <: ULogarithmic && x1 < 0 && continue + x2 = x1 + 1e-12 + y1 = A(x1) + y2 = A(x2) + @test @inferred(isapprox(y1, y2; atol=1e-11)) == isapprox(x1,x2; atol=1e-11) + end + end + @testset "<" begin for A in atypes, x1 in vals, x2 in vals A <: ULogarithmic && (x1 < 0 || x2 < 0) && continue