Skip to content

Commit 4632a71

Browse files
committed
modified printing of interval boxes
1 parent fd9311f commit 4632a71

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/display.jl

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,11 @@ function subscriptify(n::Integer)
272272
join( [Char(subscript_0 + i) for i in dig])
273273
end
274274

275+
function superscriptify(n::Integer)
276+
exps = ['', '¹', '²', '³', '', '', '', '', '', '']
277+
dig = reverse(digits(n))
278+
return join([exps[d+1] for d in dig])
279+
end
275280

276281
# fall-back:
277282
representation(a::Interval{T}, format=nothing) where T =
@@ -317,7 +322,9 @@ function representation(a::DecoratedInterval{T}, format=nothing) where T
317322
end
318323

319324

320-
function representation(X::IntervalBox, format=nothing)
325+
function representation(X::IntervalBox{N, T}, format=nothing) where {N, T}
326+
327+
all(==(first(X)), X) && return string(first(X), superscriptify(N))
321328

322329
if format == nothing
323330
format = display_params.format # default

0 commit comments

Comments
 (0)