Here you can find the source of toFixedtoFixed
function toFixed(num){ var divisor = parseInt(1 + "0".repeat(num)); return Math.round(this*divisor)/divisor } Number.prototype.toFixed = toFixed
Number.prototype.toFixed = function(exponent) { if (exponent) { var result = (parseInt(this * Math.pow(10, exponent) + 0.5) / Math.pow(10, exponent)).toString(); var count = 0; if (result.indexOf(".") > 0) { count = exponent - result.split(".")[1].length; } else { count = exponent; result += "."; ...
Number.prototype.toFixed10 = function(precision) { return Math.round10(this, -precision).toFixed(precision);
Number.prototype.toFixedB = function toFixed ( precision ) { var multiplier = Math.pow( 10, precision + 1 ), wholeNumber = Math.floor( this * multiplier ); return (Math.round( wholeNumber / 10 ) * 10 / multiplier).toFixed(precision);
Number.prototype.toFixedDown = function(digits) { var n = this - Math.pow(10, -digits)/2; n += n / Math.pow(2, 53); return n.toFixed(digits);
Number.prototype.toFixedDown = function(digits) { var re = new RegExp('(\\d+\\.\\d{' + digits + '})(\\d)'), m = this.toString().match(re); return m ? parseFloat(m[1]) : this.valueOf(); };
Number.prototype.toFloorFixed = function (accuracy) { var k = Math.pow(10, accuracy) return (Math.floor(this * k) / k).toString() Date.prototype.toInternetTime = function (accuracy) { const BeatInSeconds = 86.4 const utcHours = this.getUTCHours() const hours = utcHours !== 23 ? utcHours + 1 : 0 const BielMeanTime = this.getUTCSeconds() + this.getUTCMinutes() * 60 + hours * 3600 ...
Number.prototype.toNumFixed = function (num) { return parseFloat(this.toFixed(num));
Number.prototype.splitThousands = function () { var s = this.toString(); var thousands = Math.floor(this / 1000).toString(); return this > 999 ? ("{0} {1}").format(thousands, s.slice(thousands.length, s.length)) : s; };
Number.prototype.to2Digits = function () { return this.toFixed(2).toString().replace(".", ","); };