float-equal
DefinitelyTyped icon, indicating that this package has TypeScript declarations provided by the separate @types/float-equal package

3.0.0 • Public • Published

float-equal

Check if two floats are almost equal

Due to rounding errors you shouldn't compare floats directly. Instead this module takes an upperbound for rounding errors into consideration.

Install

$ npm install float-equal

Usage

import floatEqual from 'float-equal';

console.log(0.1 + 0.2 === 0.3);
//=> false

console.log(floatEqual(0.1 + 0.2, 0.3));
//=> true

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 3.0.0
    126
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 3.0.0
    126
  • 2.0.0
    625
  • 1.0.0
    127

Package Sidebar

Install

npm i float-equal

Weekly Downloads

719

Version

3.0.0

License

MIT

Unpacked Size

2.59 kB

Total Files

4

Last publish

Collaborators

  • sindresorhus