Here you can find the source of roundNumber.prototype.round || (precision)
/**//from w w w . j a va 2 s .c o m * Rounds a number to a given precision and omits trailing 0 values. * * @example 100.51235.round(3) * 100.512 * * @param precision {Number} The level of procision, i.e. how many decimals * appear. * * @return {Number} The given number, rounded to the given precision. */ Number.prototype.round = Number.prototype.round || function (precision) { return Math.round(this * Math.pow(10, (precision || 2))) / Math.pow(10, (precision || 2)) }
Number.prototype.round = function(precision){ if (Object.isUndefined(precision)){ return Math.round(this); precision = Math.pow(10, precision); return Math.round(this * precision) / precision; };
Number.prototype.round = function (precision) { precision = Math.pow(10, precision || 0); return Math.round(this * precision) / precision; };
Number.prototype.round5 = function() { return ((this)- (this % 5));
Number.prototype.roundDecimal = function() { return Math.roundDecimal(this); };
Number.prototype.roundMoney = Number.prototype.toObject || function roundMoney(decimals = 2) { return Number((Math.round(this + "e" + decimals) + "e-" + decimals)); };
Number.prototype.roundTo = function() { return 32 * Math.round(this / 32);
Number.prototype.roundTo = function(num) { var resto = this%num; if (resto <= (num/2)) { return this-resto; } else { return this+num-resto; };
Number.prototype.roundToFixed = function (radix) { var val = this; radix = radix || 0; val *= Math.pow(10, radix); val = Math.round(val); val /= Math.pow(10, radix); return val; };
Number.prototype.roundToPrec = function(precision) var power = Math.pow(10, precision || 0); return Math.round(this * power) / power;