Skip to content

Commit 2c646c0

Browse files
committed
Directly construct the intervals
1 parent 9fd3784 commit 2c646c0

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

src/decorations/functions.jl

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -323,23 +323,22 @@ end
323323

324324
# The function is unbounded at the bounded edges of the domain
325325
restricted_functions1 = Dict(
326-
:log => [0, Inf],
327-
:log2 => [0, Inf],
328-
:log10 => [0, Inf],
329-
:atanh => [-1, 1]
326+
:log => Interval{Float64}(0.0, Inf),
327+
:log2 => Interval{Float64}(0.0, Inf),
328+
:log10 => Interval{Float64}(0.0, Inf),
329+
:atanh => Interval{Float64}(-1.0, 1.0)
330330
)
331331

332332
# The function is bounded at the bounded edge(s) of the domain
333333
restricted_functions2 = Dict(
334-
:sqrt => [0, Inf],
335-
:asin => [-1, 1],
336-
:acos => [-1, 1],
337-
:acosh => [1, Inf]
334+
:sqrt => Interval{Float64}(0.0, Inf),
335+
:asin => Interval{Float64}(-1.0, 1.0),
336+
:acos => Interval{Float64}(-1.0, 1.0),
337+
:acosh => Interval{Float64}(1.0, Inf)
338338
)
339339

340340
# Define functions with restricted domains on DecoratedInterval's:
341341
for (f, domain) in restricted_functions1
342-
domain = interval(domain...)
343342
@eval function Base.$(f)(xx::DecoratedInterval{T}) where T
344343
x = interval(xx)
345344
r = $(f)(x)
@@ -350,7 +349,6 @@ for (f, domain) in restricted_functions1
350349
end
351350

352351
for (f, domain) in restricted_functions2
353-
domain = interval(domain...)
354352
@eval function Base.$(f)(xx::DecoratedInterval{T}) where T
355353
x = interval(xx)
356354
r = $(f)(x)

0 commit comments

Comments
 (0)