Skip to content

Commit

Permalink
Re-implement single argument @interval
Browse files Browse the repository at this point in the history
  • Loading branch information
OlivierHnt committed Apr 8, 2024
1 parent e6169a3 commit e0fa634
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/intervals/construction.jl
Original file line number Diff line number Diff line change
Expand Up @@ -627,6 +627,7 @@ end
# macro

"""
@interval(expr)
@interval(T, expr)
@interval(T, expr1, expr2)
Expand All @@ -638,13 +639,20 @@ constructor [`atomic`](@ref).
```jldoctest
julia> setdisplay(:full);
julia> @macroexpand @interval Float64 sin(1)
julia> @macroexpand @interval sin(1) # Float64 is the default bound type
:(sin(IntervalArithmetic.atomic(Float64, 1)))
julia> @macroexpand @interval Float32 sin(1)
:(sin(IntervalArithmetic.atomic(Float32, 1)))
julia> @interval Float64 sin(1) exp(1)
Interval{Float64}(0.8414709848078965, 2.7182818284590455, com)
```
"""
macro interval(expr)
return _wrap_interval(default_numtype(), expr)
end

macro interval(T, expr)
return _wrap_interval(T, expr)
end
Expand Down

0 comments on commit e0fa634

Please sign in to comment.