Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ keywords = ["math", "floating-point", "doubledouble", "extended-precision", "acc
license = "MIT"
desc = "extended precision floating point types using value pairs"
repo = "https://github.com/JuliaMath/DoubleFloats.jl.git"
version = "1.5.2"
version = "1.5.3"

[deps]
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
Expand Down
4 changes: 2 additions & 2 deletions src/type/compare.jl
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ end
return (LO(x) !== LO(y)) || (HI(x) !== HI(y) || posnegzeros(HI(x),HI(y)))
end
@inline function (<)(x::DoubleFloat{T}, y::DoubleFloat{T}) where {T<:IEEEFloat}
return (HI(x) < HI(y)) || (HI(x) == HI(y) && LO(x) < LO(y))
return (HI(x) < HI(y)) || (HI(x) === HI(y) && LO(x) < LO(y))
end
@inline function (<=)(x::DoubleFloat{T}, y::DoubleFloat{T}) where {T<:IEEEFloat}
return (HI(x) < HI(y)) || (HI(x) == HI(y) && LO(x) <= LO(y))
return (HI(x) < HI(y)) || (HI(x) === HI(y) && LO(x) <= LO(y)) || posnegzeros(HI(x), HI(y))
end

@inline function isequal(x::DoubleFloat{T}, y::DoubleFloat{T}) where {T<:IEEEFloat}
Expand Down
17 changes: 17 additions & 0 deletions test/compare.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ f3 = 3.0
d3 = Double64(3.0)
b3 = BigFloat(3)
r3 = 3//1
p0 = Double64(0.0)
n0 = Double64(-0.0)

small = Double64(0.25*eps(1.0))
gt1 = one(Double64) + small
Expand Down Expand Up @@ -127,3 +129,18 @@ end
@test lt1 < 1.0
@test !(lt1 > 1.0)
end

@testset "compare zeros" begin
@test !(p0 === n0)
@test p0 == n0

@test p0 <= n0
@test n0 <= p0
@test !(p0 < n0)
@test !(n0 < p0)

@test p0 >= n0
@test n0 >= p0
@test !(p0 > n0)
@test !(n0 > p0)
end
Loading