Skip to content

Commit 71525f1

Browse files
committed
Maintain v0.6 compatibility
1 parent a94b999 commit 71525f1

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

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); digits=fs.prec)
174+
rax = (@static VERSION < v"0.7.0-DEV.4804" ? round(abs(x), fs.prec) :
175+
round(abs(x); digits=fs.prec))
175176
sch = _signchar(x, fs.sign)
176177
intv = trunc(Integer, rax)
177178
decv = rax - intv
@@ -226,7 +227,8 @@ function _pfmt_e(out::IO, fs::FormatSpec, x::AbstractFloat)
226227
e = 0
227228
u = zero(x)
228229
else
229-
rax = round(ax; sigdigits = fs.prec + 1)
230+
rax = (@static VERSION < v"0.7.0-DEV.4804" ? signif(ax, fs.prec + 1) :
231+
round(ax; sigdigits = fs.prec + 1))
230232
e = floor(Integer, log10(rax)) # exponent
231233
u = rax * exp10(-e) # significand
232234
end

0 commit comments

Comments
 (0)