amos-tool
Version:
amos ui tool
41 lines (39 loc) • 963 B
JavaScript
;
var _boost = function(t, n, r, u) {
var o = 0, i = 0;
u = null == u ? 1 : u;
try {
o = t.toString().split(".")[1].length;
} catch (t) {}
try {
i = n.toString().split(".")[1].length;
} catch (t) {}
return r(Number(t.toString().replace(".", "")) * Math.pow(10, i), Number(n.toString().replace(".", "")) * Math.pow(10, o)) / Math.pow(10, (o + i) * u);
}, mod = function(t, n) {
return _boost(t, n, function(t, n) {
return t % n;
});
}, plus = function(t, n) {
return _boost(t, n, function(t, n) {
return t + n;
});
}, subtract = function(t, n) {
return _boost(t, n, function(t, n) {
return t - n;
});
}, multiply = function(t, n) {
return _boost(t, n, function(t, n) {
return t * n;
}, 2);
}, divide = function(t, n) {
return _boost(t, n, function(t, n) {
return t / n;
}, 0);
};
module.exports = {
mod: mod,
plus: plus,
subtract: subtract,
multiply: multiply,
divide: divide
};