Subversion Repositories JSX

Compare Revisions

Last modification

Ignore whitespace Rev 532 → Rev 533

/trunk/math.js
288,7 → 288,31
*/
isNatural: function (n) {
return n >= 0 && _isInteger(n);
}
},
 
/**
* The signum (sign) function.
*
* {@link Math.sign()} is used if available.
*
* @function
*/
sgn: (function () {
return (typeof Math.sign == "function"
? Math.sign
: /**
* @param {Number} x
* @return {number}
* <code>-1</code> if <code><var>x</var> &lt; 0</code>;
* <code>-0</code> if <code><var>x</var> === -0</code>;
* <code>+0</code> if <var>x</var> === <code>+0</code>;
* <code>1</code> if <code><var>x</var> > 0</code>, and
* <code>NaN</code> if <code>isNaN(<var>x</var>)</code>.
*/
function (x) {
return x / Math.abs(x);
});
}())
};
}());