Skip to content

Commit

Permalink
Fix StackOverFlow
Browse files Browse the repository at this point in the history
  • Loading branch information
OlivierHnt committed Dec 1, 2023
1 parent 5fb425d commit 7b2def0
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions src/intervals/interval_operations/numeric.jl
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ function inf(x::Interval{<:Rational})
return inf(bareinterval(x))
end

inf(x::Real) = inf(x)
inf(x::Real) = x

"""
sup(x)
Expand All @@ -50,7 +50,7 @@ function sup(x::Interval{<:Rational})
return sup(bareinterval(x))
end

sup(x::Real) = sup(x)
sup(x::Real) = x

"""
bounds(x)
Expand All @@ -73,7 +73,7 @@ function bounds(x::Interval{<:Rational})
return bounds(bareinterval(x))
end

bounds(x::Real) = bounds(x)
bounds(x::Real) = (x, x)

"""
mid(x)
Expand Down Expand Up @@ -121,7 +121,7 @@ function mid(x::Interval{<:Rational})
return mid(bareinterval(x))
end

mid(x::Real) = mid(interval(x))
mid(x::Real) = x
mid(x::Complex) = complex(mid(real(x)), mid(imag(x)))

"""
Expand Down Expand Up @@ -175,7 +175,7 @@ function scaled_mid(x::Interval{<:Rational}, α::Real)
return scaled_mid(bareinterval(x), α)
end

scaled_mid(x::Real, α::Real) = scaled_mid(interval(x), α)
scaled_mid(x::Real, ::Real) = x
scaled_mid(x::Complex, α::Real) = complex(scaled_mid(real(x), α), scaled_mid(imag(x), α))

"""
Expand Down Expand Up @@ -207,7 +207,7 @@ function diam(x::Interval{<:Rational})
return diam(bareinterval(x))
end

diam(x::Real) = diam(interval(x))
diam(x::Real) = zero(x)
diam(x::Complex) = max(diam(real(x)), diam(imag(x)))

"""
Expand Down Expand Up @@ -236,7 +236,7 @@ function radius(x::Interval{<:Rational})
return radius(bareinterval(x))
end

radius(x::Real) = radius(interval(x))
radius(x::Real) = zero(x)
radius(x::Complex) = max(radius(real(x)), radius(imag(x)))

"""
Expand Down Expand Up @@ -264,7 +264,7 @@ function midradius(x::Interval{<:Rational})
return midradius(bareinterval(x))
end

midradius(x::Real) = midradius(interval(x))
midradius(x::Real) = (mid(x), radius(x))
midradius(x::Complex) = (mid(x), radius(x))

"""
Expand Down Expand Up @@ -294,8 +294,8 @@ function mag(x::Interval{<:Rational})
return mag(bareinterval(x))
end

mag(x::Real) = mag(interval(x))
mag(x::Complex) = mag(interval(x))
mag(x::Real) = abs(x)
mag(x::Complex) = max(mag(real(x)), mag(imag(x)))

"""
mig(x)
Expand Down Expand Up @@ -326,8 +326,8 @@ function mig(x::Interval{<:Rational})
return mig(bareinterval(x))
end

mig(x::Real) = mig(interval(x))
mig(x::Complex) = mig(interval(x))
mig(x::Real) = abs(x)
mig(x::Complex) = min(mag(real(x)), mag(imag(x)))

"""
dist(x, y)
Expand Down

0 comments on commit 7b2def0

Please sign in to comment.