Skip to content

Commit

Permalink
Infinite BigFloat rendered as Inf instead of inf for consistency
Browse files Browse the repository at this point in the history
  • Loading branch information
dpsanders committed Sep 19, 2015
1 parent 7370bcd commit ca34377
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion base/mpfr.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down

0 comments on commit ca34377

Please sign in to comment.