Skip to content

Commit 555df90

Browse files
dpsanderslbenet
authored andcommitted
Fix printing of intervals (#246)
1 parent 4610a0f commit 555df90

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/display.jl

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,18 +102,24 @@ macro format(expr...)
102102
end
103103

104104

105+
if VERSION < v"1.1.0-DEV.683"
106+
to_mpfr(r) = Base.MPFR.to_mpfr(r)
107+
else
108+
to_mpfr(r) = convert(Base.MPFR.MPFRRoundingMode, r)
109+
end
110+
105111
## Output
106112

107-
# round to given number of signficant digits
113+
# round to given number of significant digits
108114
# basic structure taken from string(x::BigFloat) in base/mpfr.jl
109115
function round_string(x::BigFloat, digits::Int, r::RoundingMode)
110116

111117
lng = digits + Int32(8)
112118
buf = Array{UInt8}(undef, lng + 1)
113119

114-
lng = ccall((:mpfr_snprintf,:libmpfr), Int32,
120+
lng = ccall((:mpfr_snprintf, :libmpfr), Int32,
115121
(Ptr{UInt8}, Culong, Ptr{UInt8}, Int32, Ref{BigFloat}...),
116-
buf, lng + 1, "%.$(digits)R*g", Base.MPFR.to_mpfr(r), x)
122+
buf, lng + 1, "%.$(digits)R*g", to_mpfr(r), x)
117123

118124
repr = unsafe_string(pointer(buf))
119125

0 commit comments

Comments
 (0)