arithmetic.js
A small library for mathematical operation in Javascript. only support:
- add (+)
- sub (-)
- mul (*)
- div (/)
Usage
arithmetic.js is easiest to use when installed with npm:
npm install arithmetic.js --save
import
or require
call:
Then you can load the module into your code with a ;// orvar arithmetic = ;
Now, there're two methods for you to do the mathematics:
- smpCal
var smpCal = arithmeticsmpCal; smpCal //0.3smpCal //3smpCal //4smpCal //2
- chainCal
chainCal support method chaining, and you can get the result by using function named getValue;
var chainCal = arithmeticchainCal;// (3 + 0.2 - 1)/4*5; // 2.75
Note
arithmetic.js do not support big number;
License
MIT