+30
@@ -0,0 +1,30 @@
|
||||
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;
|
||||
Reference in New Issue
Block a user