JuliaLang/julia — pull request #1254 by HarlanH (2012-09-04 21:17:24+00:00)
Title: two/three-argument round()

Note not vectorized.
Also, arguably should be two-arg ceil/floor/trunc too? (calling three-arg round)
Is the performance hit for arg checking worthwhile?

```julia
julia> round(pi)
3.0

julia> round(pi, 5)
3.1416

julia> round(123.456, 5)
123.46000000000001

julia> round(123.456, 2)
120.0

julia> round(123.456, 4, round)
123.5

julia> round(123.456, 4, floor)
123.4

julia> round(123.456, 4, ceil)
123.5

julia> round(123.456, 4, trunc)
123.4

julia> round(-123.456, 4, round)
-123.5

julia> round(-123.456, 4, floor)
-123.5

julia> round(-123.456, 4, ceil)
-123.4

julia> round(-123.456, 4, trunc)
-123.4

julia> round(123.456, 4, sin) # meaningless -- doesn't check args
0.008580721236705982

julia> round(123.456, 2.5) # YMMV
123.0

```