Skip to content

Commit

Permalink
Rewrite dotdot operator
Browse files Browse the repository at this point in the history
  • Loading branch information
dpsanders committed Feb 18, 2017
1 parent 29eec1c commit 3afab5b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/intervals/conversion.jl
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,11 @@ convert{T<:Integer, S<:BigFloat}(::Type{Interval{Rational{T}}}, x::S) =
Interval(rationalize(T, x))


# conversion to Interval without explicit type:
function convert(::Type{Interval}, x::Real)
T = typeof(float(x))

return convert(Interval{T}, x)
end

convert(::Type{Interval}, x::Interval) = x
2 changes: 1 addition & 1 deletion src/intervals/intervals.jl
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ include("hyperbolic.jl")

# Syntax for intervals

a..b = @interval(a, b)
a..b = Interval(convert(Interval, a).lo, convert(Interval, b).hi)

macro I_str(ex) # I"[3,4]"
@interval(ex)
Expand Down

0 comments on commit 3afab5b

Please sign in to comment.