fixfloat

1.0.1 • Public • Published

fixfloat

npm npm GitHub license

You can use it to fix the float-number bug in javascript.

const fixfloat = require('fixfloat');
 
const floatNumber = 0.1 + 0.2; // 0.30000000000000004
 
fixfloat(floatNumber); // 0.3

You can also use it to round your number.

const fixfloat = require('fixfloat');
 
const floatNumber = 3456.3456;
 
fixfloat(floatNumber); // 3456.3
fixfloat(floatNumber, 2); // 3456.35
fixfloat(floatNumber, 1); // 3456.3
fixfloat(floatNumber, 0); // 3456
fixfloat(floatNumber, -1); // 3460
fixfloat(floatNumber, -3); // 3000

Install

npm install fixfloat --save

Package Sidebar

Install

npm i fixfloat

Weekly Downloads

0

Version

1.0.1

License

none

Unpacked Size

3.05 kB

Total Files

5

Last publish

Collaborators

  • wangdagen