🔍SmallInt
smallInt
Add smaller numbers with better accuracy!
Example
const { SmallInt } = require('coreplus')('smallInt');
const smallNumber = new SmallInt(0.2);
console.log(+smallNumber);
console.log(+smallNumber.plus(0.1));
smallNumber.add(0.137);
console.log(+smallNumber);
0.2
0.3
0.337
Use
First, require the SmallInt
class using the namespace smallInt
const { SmallInt } = require('coreplus')('smallInt');
Then create a variable that takes in a new SmallInt
, in the SmallInt
add the number you want to be converted to a SmallInt
const foo = new SmallInt(bar);
Prototype
Operation
.add
+=
.plus
+
.subtract
-=
.minus
-
.multiply
*=
.times
*
.divide
/=
.over
/
.remainder
%=
.modulus
%
Last updated