I used below two methods :
Number.prototype.myRound = function (decimalPlaces) { var multiplier = Math.pow(10, decimalPlaces); return (Math.round(th
The problem is probably floating point inaccuracy, thus you might get different results in different cases (different gathering of a number, different browsers etc.).
See also this: toFixed(2) rounds "x.525" inconsistently?