From ca343772044c9ab2a2b28df721ec124f832c95c7 Mon Sep 17 00:00:00 2001 From: "David P. Sanders" Date: Sat, 19 Sep 2015 15:45:28 -0500 Subject: [PATCH] Infinite BigFloat rendered as Inf instead of inf for consistency --- base/mpfr.jl | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/base/mpfr.jl b/base/mpfr.jl index c801da6eddd17..0ba693e33d602 100644 --- a/base/mpfr.jl +++ b/base/mpfr.jl @@ -915,7 +915,10 @@ function string(x::BigFloat) buf = Array(UInt8, lng + 1) lng = ccall((:mpfr_snprintf,:libmpfr), Int32, (Ptr{UInt8}, Culong, Ptr{UInt8}, Ptr{BigFloat}...), buf, lng + 1, "%.Re", &x) end - return bytestring(pointer(buf), (1 <= x < 10 || -10 < x <= -1 || x == 0) ? lng - 4 : lng) + + repr = bytestring(pointer(buf), (1 <= x < 10 || -10 < x <= -1 || x == 0) ? lng - 4 : lng) + return repr == "inf" ? "Inf" : repr + end print(io::IO, b::BigFloat) = print(io, string(b))