Skip to content
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
11 changes: 4 additions & 7 deletions src/decorations/functions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ bool_functions = (
)

bool_binary_functions = (
:<, :>, :!=, :⊆, :<=,
:<, :>, :!=, :⊆, :<=, :(==),
:isinterior, :isdisjoint, :precedes, :strictprecedes
)

Expand All @@ -36,18 +36,15 @@ for f in bool_functions
end

for f in bool_binary_functions
@eval $(f)(xx::DecoratedInterval, yy::DecoratedInterval) =
@eval function $(f)(xx::DecoratedInterval, yy::DecoratedInterval)
(isnai(xx) || isnai(yy)) && return false
$(f)(interval(xx), interval(yy))
end
end

in(x::T, a::DecoratedInterval) where T<:Real = in(x, interval(a))


function ==(x::DecoratedInterval, y::DecoratedInterval)
isnai(x) && isnai(y) && return true
return (==(interval(x), interval(y)))
end

## scalar functions: mig, mag and friends
scalar_functions = (
:mig, :mag, :inf, :sup, :mid, :diam, :radius, :dist, :eps
Expand Down
4 changes: 2 additions & 2 deletions test/ITF1788_tests/ieee1788-constructors.jl
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ end

# Example from Section 11.3
@testset "IEEE1788.e" begin
@test DecoratedInterval(2, 1) == nai()
@test isnai(DecoratedInterval(2, 1))
end

# Examples from Table 12.1
Expand Down Expand Up @@ -99,7 +99,7 @@ end
@test decoration(@decorated("-10??u")) == decoration(DecoratedInterval(Interval(-10.0, Inf), dac))
@test @decorated("-10??") == DecoratedInterval(Interval(-Inf, Inf), dac)
@test decoration(@decorated("-10??")) == decoration(DecoratedInterval(Interval(-Inf, Inf), dac))
@test @decorated("[nai]") == nai()
@test isnai(@decorated("[nai]"))
@test @decorated("3.56?1_def") == DecoratedInterval(Interval(0x3.8ccccccccccccp+0, 0x3.91eb851eb8520p+0), def)
@test decoration(@decorated("3.56?1_def")) == decoration(DecoratedInterval(Interval(0x3.8ccccccccccccp+0, 0x3.91eb851eb8520p+0), def))
end
Expand Down
Loading