Skip to content
This repository was archived by the owner on Dec 10, 2023. It is now read-only.

Update definition of < operator #29

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
3 changes: 1 addition & 2 deletions src/DoubleDouble.jl
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,8 @@ Double(x::BigFloat) = convert(Double{Float64}, x)
Double(x::Irrational) = convert(Double{Float64}, x)

# <

function <{T}(x::Double{T}, y::Double{T})
x.hi + x.lo < y.hi + y.lo
x.hi < y.hi || (x.hi == y.hi && x.lo < y.lo)
end

# add12
Expand Down
3 changes: 3 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ bxy = bx*by

#@test rem(dxy,1.0) == Double(rem(bxy,1.0))

let x = Double(big"3.1")
@test Double(x.hi, prevfloat(x.lo)) < x < Double(x.hi, nextfloat(x.lo))
end

## New
@test Double(pi) == Double{Float64}(3.141592653589793, 1.2246467991473532e-16)
Expand Down