Here you can find the source of sqrt()
Number.prototype.sqrt = function() { return Math.sqrt(this); };
'use strict' Number.prototype.sigFig = function(precision){ if( !precision ) precision = 2; var d = Math.pow(10, precision); return ( parseInt( this.valueOf() * d) / d ).toFixed(precision); };
DEFAULT_DIGIT = 5; Number.prototype.simEq = function(number, digits) { digits = digits == undefined ? DEFAULT_DIGIT : digits; var n1 = this.toFixed(digits); var n2 = number.toFixed(digits); if (n1 == -0) n1 = 0; if (n2 == -0) n2 = 0; ...
Number.prototype.sin = function() { return Math.sin(this);
Number.prototype.smallerThan = function(num) { return this < num;
Number.prototype.snap = function(resolution) { return Math.floor(this / resolution) * resolution; };
var expect = chai.expect; Number.prototype.square = function () { "use strict"; return this * this; };
Number.prototype.square = function() { return this * this; };
Number.prototype.step = function (to, add_remove_step) { var from = this.valueOf(); var ch = add_remove_step.match(/[\+,\-]/g)[0]; var i = from; var arr = []; if (ch === '+') { while (i <= to) { arr.push(i); i = i + parseInt(add_remove_step); ...
Number.prototype.subNum = function(n){ var f_x = parseFloat(this); if (isNaN(f_x)){ return false; f_x = Math.floor(f_x*Math.pow(10,n)+0.0001)/Math.pow(10,n); var s_x = f_x.toString(); var pos_decimal = s_x.indexOf('.'); if (pos_decimal < 0){ ...