Compact float printing in the REPL


#1

How can I globally change the printing format of the REPL? I would specifically like to change the formatting of floats to a more compact style so that

julia> 10/3
3.3333

instead of

julia> 10/3
3.3333333333333335

I found this issue which was closed without resolution.

Looking at the code I see that

function Base.show(io::IO, x::Union{Float64,Float32})
    if get(io, :compact, false)
        _show(io, x, PRECISION, 6, true, true)
    else
        _show(io, x, SHORTEST, 0, true, false)
    end
end

refers to :compact but I don’t know how to set this. The REPL formatting section of the manual doesn’t mention it either.