You could use a type:

    julia> type Out
              n::Float64
           end

    julia> function Base.show(io::IO, n::Out)
               print(io, "$(round(n.n, 2))")
           end
    show (generic function with 83 methods)

then you can just use Out(x) whenever you want x rounded to 2 d.p.

        julia> for i in 0.7454539:1.5:5
               println("i is $i and displayed as $(Out(i))")
           end
    i is 0.7454539 and displayed as 0.75                
    i is 2.2454539000000002 and displayed as 2.25                
    i is 3.7454539000000002 and displayed as 3.75           

Reply via email to