Skip to content

Commit 162ea7d

Browse files
authored
ceil_neg_log10(x) for non-finite x (#322)
1 parent bfaa6f8 commit 162ea7d

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/common.jl

+5-4
Original file line numberDiff line numberDiff line change
@@ -342,10 +342,11 @@ function nice_repr(
342342
str
343343
end
344344

345-
ceil_neg_log10(x) =
346-
let val = -log10(x)
347-
roundable(val) ? ceil(Int, val) : floor(Int, val)
348-
end
345+
function ceil_neg_log10(x)
346+
val = -log10(x)
347+
isfinite(val) || return typemin(Int)
348+
roundable(val) ? ceil(Int, val) : floor(Int, val)
349+
end
349350

350351
round_up_subtick(x::T, m) where {T} = T(x == 0 ? 0 : if x > 0
351352
ceil(x, digits = ceil_neg_log10(m) + 1)

0 commit comments

Comments
 (0)