1.0.4 • Published 8 years ago

arithmetic.js v1.0.4

Weekly downloads
2
License
MIT
Repository
github
Last release
8 years ago

arithmetic.js

A small library for mathematical operation in Javascript. only support:

  • add (+)
  • sub (-)
  • mul (*)
  • div (/)

Travis license

Usage

arithmetic.js is easiest to use when installed with npm:

npm install arithmetic.js --save

Then you can load the module into your code with a import or require call:

import arithmetic from "arithmetic.js";
// or
var arithmetic = require("arithmetic.js");

Now, there're two methods for you to do the mathematics:

  1. smpCal
var smpCal = arithmetic.smpCal;

smpCal.add(0.1,0.2) //0.3
smpCal.sub(2,1) //3
smpCal.mul(2,2) //4
smpCal.div(6,3) //2
  1. chainCal

chainCal support method chaining, and you can get the result by using function named getValue;

var chainCal = arithmetic.chainCal;
// (3 + 0.2 - 1)/4*5
chainCal(3).add(0.2).sub(1).div(4).mul(5).getValue(); // 2.75

Note

arithmetic.js do not support big number;

License

MIT

1.0.4

8 years ago

1.0.3

8 years ago

1.0.2

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago

0.1.8

8 years ago

0.1.7

8 years ago

0.1.6

8 years ago

0.1.5

8 years ago

0.1.4

8 years ago

0.1.3

8 years ago

0.1.2

8 years ago

0.1.1

8 years ago

0.1.0

8 years ago

0.0.1

8 years ago