# is-roughly-equal

> Check if a number is within a certain fault tolerance to another.

Latest version **0.1.0** (published 2016-03-22) · ISC license · 0 weekly downloads

## Install

```sh
npm install is-roughly-equal
pnpm add is-roughly-equal
yarn add is-roughly-equal
bun add is-roughly-equal
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.0 |
| Published | 2016-03-22 |
| First published | 2016-03-22 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Jannis R |
| Maintainers | derhuerst |
| Keywords | equal, roughly, tolerance, number, compare |

## Links

- npm: https://www.npmjs.com/package/is-roughly-equal
- Repository: https://github.com/derhuerst/is-roughly-equal
- Issues: https://github.com/derhuerst/is-roughly-equal/issues
- npm.io page: https://npm.io/package/is-roughly-equal

## Alternatives

- [random-seedable](https://npm.io/package/random-seedable.md) — 27.9K weekly downloads
- [n2words](https://npm.io/package/n2words.md) — 22.2K weekly downloads
- [@stdlib/math-base-special-factorialln](https://npm.io/package/@stdlib/math-base-special-factorialln.md) — 5.7K weekly downloads
- [@stdlib/math-base-special-abs2](https://npm.io/package/@stdlib/math-base-special-abs2.md) — 1.7K weekly downloads
- [commons-math-interpolation](https://npm.io/package/commons-math-interpolation.md) — 1.4K weekly downloads

## Recent versions

- 0.1.0 (latest) — 2016-03-22

## README

# is-roughly-equal ❓

**Check if a number is within a certain fault tolerance to another.** [Supports currying](#api).

[![npm version](https://img.shields.io/npm/v/is-roughly-equal.svg)](https://www.npmjs.com/package/is-roughly-equal)
[![build status](https://img.shields.io/travis/derhuerst/is-roughly-equal.svg)](https://travis-ci.org/derhuerst/is-roughly-equal)
[![dependency status](https://img.shields.io/david/derhuerst/is-roughly-equal.svg)](https://david-dm.org/derhuerst/is-roughly-equal#info=dependencies)
[![dev dependency status](https://img.shields.io/david/dev/derhuerst/is-roughly-equal.svg)](https://david-dm.org/derhuerst/is-roughly-equal#info=devDependencies)

*is-roughly-equal* [is ISC-licensed](license.md) and [tested well](test.coffee).


## Installing

```
npm install is-roughly-equal
```


## Usage

```js
const isRoughlyEqual = require 'is-roughly-equal'

// without currying
isRoughlyEqual(11.1) // false
isRoughlyEqual(11)   // true
isRoughlyEqual(10)   // true
isRoughlyEqual(9)    // true
isRoughlyEqual(8.9)  // false

const check = isRoughlyEqual(1, 10) // equal to 10 with tolerance of 1
check(11.1) // false
check(11)   // true
check(10)   // true
check(9)    // true
check(8.9)  // false
```


## API

### `isRoughlyEqual([tolerance], [a], [b])`

- Called **without arguments**, returns `isRoughlyEqual.unary(1)`.
- Called **with 1 arguments** `tolerance`, returns `isRoughlyEqual.unary(tolerance)`
- Called **with 2 arguments** `tolerance` and `a`, returns `isRoughlyEqual.binary(tolerance, a)`.
- Called **with 3 arguments** `tolerance`, `a` and `b`, returns `isRoughlyEqual.ternary(tolerance, a, b)`.

### `isRoughlyEqual.unary(tolerance)`

Returns a function `(a, b) => isRoughlyEqual.ternary(tolerance, a, b)`.

### `isRoughlyEqual.binary(tolerance, a)`

Returns a function `(b) => isRoughlyEqual.ternary(tolerance, a, b)`.

### `isRoughlyEqual.ternary(tolerance, a, b)`

Returns `true` of `false`. **Checks if `a` is within a distance of `tolerance` to `b`.**


## Contributing

If you **have a question**, **found a bug** or want to **propose a feature**, have a look at [the issues page](https://github.com/derhuerst/is-roughly-equal/issues).

---
_Source: https://npm.io/package/is-roughly-equal · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
