31 lines
446 B
JavaScript
31 lines
446 B
JavaScript
function IMath() {
|
|
}
|
|
|
|
/**
|
|
* This method returns the sign of the input value.
|
|
*/
|
|
IMath.sign = function (value) {
|
|
if (value > 0)
|
|
{
|
|
return 1;
|
|
}
|
|
else if (value < 0)
|
|
{
|
|
return -1;
|
|
}
|
|
else
|
|
{
|
|
return 0;
|
|
}
|
|
};
|
|
|
|
IMath.floor = function (value) {
|
|
return value < 0 ? Math.ceil(value) : Math.floor(value);
|
|
};
|
|
|
|
IMath.ceil = function (value) {
|
|
return value < 0 ? Math.floor(value) : Math.ceil(value);
|
|
};
|
|
|
|
module.exports = IMath;
|