From f4a0bf7a2f798d51677196024294066351d0af46 Mon Sep 17 00:00:00 2001 From: David Sanders Date: Wed, 5 Dec 2018 00:57:16 -0600 Subject: [PATCH] Fix printing of intervals --- src/display.jl | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/display.jl b/src/display.jl index 3f2ea92d4..680e02ce4 100644 --- a/src/display.jl +++ b/src/display.jl @@ -102,18 +102,24 @@ macro format(expr...) end +if VERSION < v"1.1.0-DEV.683" + to_mpfr(r) = Base.MPFR.to_mpfr(r) +else + to_mpfr(r) = convert(Base.MPFR.MPFRRoundingMode, r) +end + ## Output -# round to given number of signficant digits +# round to given number of significant digits # basic structure taken from string(x::BigFloat) in base/mpfr.jl function round_string(x::BigFloat, digits::Int, r::RoundingMode) lng = digits + Int32(8) buf = Array{UInt8}(undef, lng + 1) - lng = ccall((:mpfr_snprintf,:libmpfr), Int32, + lng = ccall((:mpfr_snprintf, :libmpfr), Int32, (Ptr{UInt8}, Culong, Ptr{UInt8}, Int32, Ref{BigFloat}...), - buf, lng + 1, "%.$(digits)R*g", Base.MPFR.to_mpfr(r), x) + buf, lng + 1, "%.$(digits)R*g", to_mpfr(r), x) repr = unsafe_string(pointer(buf))