calc.js - evaluate expressions for Math
MarkdownView HTML version
Flexible expression parser and offers an integrated solution to work with numbers, big numbers, complex numbers, units, and matrices. Powerful and easy to use.
[](https://github.com/duyet/calc.js)
## Install
```
npm install calc.js
```
## Usage
```js
var calc = require('calc.js')
calc('12 / (2.3 + 0.7)') // 4
calc('5.08 cm to inch') // 2 inch
calc('sin(45 deg) ^ 2') // 0.5
calc('9 / 3 + 2i') // 3 + 2i
calc('det([-1, 2; 3, 1])') // -7
```
## Credit
Thanks to [mathjs](https://github.com/josdejong/mathjs) eval.
## Source
- [calc.js](https://github.com/duyet/calc.js) | Github
- [calc.js](https://www.npmjs.com/package/calc.js) | NPM