Skip to content

Commit 900a094

Browse files
committed
round keyword arguments: digits, sigdigits
1 parent 13f5cc4 commit 900a094

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

REQUIRE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
julia 0.6
2-
Compat 0.62.0
2+
Compat 0.64.0

src/fmtcore.jl

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,8 @@ end
171171

172172
function _pfmt_f(out::IO, fs::FormatSpec, x::AbstractFloat)
173173
# separate sign, integer, and decimal part
174-
rax = round(abs(x), fs.prec)
174+
# when https://github.com/JuliaLang/Compat.jl/pull/537 is merged, remove base = 10
175+
rax = Compat.round(abs(x), digits = fs.prec, base = 10)
175176
sch = _signchar(x, fs.sign)
176177
intv = trunc(Integer, rax)
177178
decv = rax - intv
@@ -230,7 +231,8 @@ function _pfmt_e(out::IO, fs::FormatSpec, x::AbstractFloat)
230231
e = 0
231232
u = zero(x)
232233
else
233-
rax = signif(ax, fs.prec + 1)
234+
# when https://github.com/JuliaLang/Compat.jl/pull/537 is merged, remove base = 10
235+
rax = Compat.round(ax, sigdigits = fs.prec + 1, base = 10)
234236
e = floor(Integer, log10(rax)) # exponent
235237
u = rax * exp10(-e) # significand
236238
end

0 commit comments

Comments
 (0)