Here you can find the source of round(decimals)return round(this,decimals);}
/**/*w w w . java2s . c o m*/ * Rounds to N decimals * * @param {Number} number * @param {Number} decimals * @return {Number} */ exports.round = function(number,decimals){return round(number,decimals);} Number.prototype.round = function(decimals){return round(this,decimals);} var round = function(number,decimals){ if(!isNaN(number)){ var d = 1; if(!isNaN(decimals)){ d = Math.pow(10,decimals) } return Math.round(number * d)/d; } return null; }
Number.prototype.$round = function(fractionalDigits) { return parseFloat(this.toFixed(fractionalDigits)); };
Number.prototype.ToRound = function (digits) { if (digits < 0 || digits > 10) return this; var pow10 = Math.pow(10, digits); return Math.round(this * pow10) / pow10; };
Number.prototype.round = function() { return Math.round(this); };
Number.prototype.round = function() { return Math.round(this); };
Number.prototype.round = function(d) { const string_number = String(this) const split_string = string_number.split('.') if (split_string.length === 1) return this const integer_chunk = split_string[0] if (!d) return integer_chunk const decimal_chunk = split_string[1] const determinig_digit = parseInt(decimal_chunk[d]) if (determinig_digit < 5) { ...
Number.prototype.round = function(dp) { multiplier = Math.pow(10,dp); return Math.round(this*multiplier) / multiplier;
Number.prototype.round = function(places) { return +(Math.round(this + "e+" + places) + "e-" + places); function fractionToFloat(str) var complexParts = str.split(' '); var result = 0; var f; if (complexParts.length == 1) { ...
Number.prototype.round = function(precision) { var factor = Math.pow(10, precision || 0); return Math.round(this * factor) / factor; };
Number.prototype.round = function(precision){ if (Object.isUndefined(precision)){ return Math.round(this); precision = Math.pow(10, precision); return Math.round(this * precision) / precision; };