liveme / calculatorjs

Accurately arithmetic library

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Calculatorjs

NPM version

> 2.1+2.2
4.300000000000001
> calc(' 2.1+2.2 ')
4.3

Installation

In browser

<script src="calc.js"></script>
<script>
    console.log(calc(' 0.1*(0.1+0.1) '))
</script>

Using npm:

npm install --save calculatorjs

In Node.js:

const calc = require('calculatorjs')

console.log(calc(' 0.1*(0.1+0.1) '))

DOC

calc(' 1+1-1*1/2+(1/1)/-1 ')

Support + - * / ( ) minus

Fast API

If you need fast calculations,you can use it,10 times faster than calc.

calc.add(0.1, 0.2) // 0.3
calc.sub(0.1, 0.2) // -0.1
calc.mul(0.1, 0.2) // 0.02
calc.div(0.1, 0.2) // 0.5

License

Distributed under MIT License.

About

Accurately arithmetic library

License:MIT License


Languages

Language:JavaScript 94.7%Language:HTML 5.3%