@f/almost-equal
v0.1.0
Published
Check if two numbers are almost equal
Downloads
5
Readme
almost-equal
Check if two numbers are almost equal.
Installation
$ npm install @f/almost-equal
Usage
var almostEqual = require('@f/almost-equal')
almostEqual(1, 1.5, 1) // -> true
almostEqual(1, 2.1, 1) // -> false
API
almostEqual(a, b, margin)
a
- First value to compare.b
- second value to compare.margin
- Margin between two numbers which is tolerated and seen as "almost equal".
Returns: A boolean if the two values a
and b
are almost equal.
License
MIT