float-compute-patch
patch v8 float compute lose precision
Translations
useful if you
- your system has floating-point operations
- involve some amount calculation
install
npm install --save float-compute-patch
usage
// without patch 2.2+2.1 in v8 = 4.300000000000001. and so on,there are many problems/**** version 1.x****/// just execute once at your entry program for expample app.js;// write like belowvar result = 22; // = 4.3 or write like this (2.2).add(2.1)// support chain writevar result = 22;/**** version 2.0.0****/// if you just want to add it to the Number prototype; // like the v1 version// if you just want to use an ordinary functionvar cal = cal;// write like belowvar result = ;
api
-
mode of patch Number prototype, you should start with a number
- add(number), addition
- sub(number), subtraction
- mul(number), multiplication
- div(number), division
-
mode of ordinary function, you should start with cal(number)
- add(number), addition
- sub(number), subtraction
- mul(number), multiplication
- div(number), division
test
npm run test