accurate-calculate
v1.1.1
Published
resolve js calculate problem such as 0.1 + 0.3 or 0.1 * 0.2
Downloads
2
Readme
accurate-calculate
Install
$ npm install accurate-calculate
Usage
不清楚为什么0.2+0.1 !== 0.3的童鞋 看一看.
// es6
import { accMul, accDiv, accAdd, accSub } from "accurate-calculate";
// common js
const { accMul, accDiv, accAdd, accSub } = require("accurate-calculate");
// no use
console.log(0.1 + 0.2);
//=> 0.30000000000000004
// use
console.log(accAdd(0.1, 0.2));
//=> 0.3