@cjser/float-equal
v3.0.0-cjser.2
Published
Check if two floats are almost equal
Maintainers
Readme
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-equalUsage
import floatEqual from 'float-equal';
console.log(0.1 + 0.2 === 0.3);
//=> false
console.log(floatEqual(0.1 + 0.2, 0.3));
//=> truecjser
This package is a CommonJS-compatible build generated by cjser for projects that still need require() support. The source version matches the original npm package version, with a cjser prerelease suffix for this generated build.
Original repository: https://github.com/sindresorhus/float-equal
