Improving round(x) function for rounding of decimals to a given number n

I tried to use the function round(x,n) to round off a decimal digit to n decimal places. But this function does not work like matlab. If this function is not available in Octave, I like to contribute to improve this function.
Thank you.

The change in behavior occurred in 2014. There are a couple existing bug reports, see: