Right, my fault.
Sorry, I am still wondering: round(x,n) rounds towards zero, even for 
non-integers
(as is documented in;
    "The round() functions return the integral value nearest to x rounding 
halfway 
     cases away from zero, regardless of the current rounding direction.")

    julia> round(0.025, 2)
    0.03

so round(x,2) works like round(100*x)/100. (This is what I do in MATLAB.)
What I would like to have is a function round_ieee(x,n) such that

    julia> round_ieee(0.025, 2)
    0.02

Can I do this somehow with with_rounding() do ... end ?


On Thursday, June 5, 2014 8:18:05 AM UTC+2, Kevin Squire wrote:
>
> It's also documented:
>
>  julia> help(round)
> INFO: Loading help data...
> Base.round(x[, digits[, base]])
>
>    "round(x)" returns the nearest integral value of the same type as
>    "x" to "x". "round(x, digits)" rounds to the specified number
>    of digits after the decimal place, or before if negative, e.g.,
>    "round(pi,2)" is "3.14". "round(x, digits, base)" rounds
>    using a different base, defaulting to 10, e.g., "round(pi, 1, 8)"
>    is "3.125".
>
>  

Reply via email to