# intexp

> frexp for integers: decomposes integer into coefficient and power of 2

Latest version **1.0.1** (published 2018-02-02) · ISC license · 0 weekly downloads

## Install

```sh
npm install intexp
pnpm add intexp
yarn add intexp
bun add intexp
```

## Health

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

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2018-02-02 |
| First published | 2017-12-31 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Antoine Beauvais-Lacasse |
| Maintainers | beaulac |
| Keywords | integer, decompose, coefficient, exponent |

## Links

- npm: https://www.npmjs.com/package/intexp
- Repository: https://github.com/beaulac/node-intexp
- Homepage: https://github.com/beaulac/node-intexp#readme
- Issues: https://github.com/beaulac/node-intexp/issues
- npm.io page: https://npm.io/package/intexp

## Recent versions

- 1.0.1 (latest) — 2018-02-02
- 1.0.0 — 2017-12-31

## README

# intexp: `frexp` for integers

Similarly to the [libc `frexp` function](https://www.gnu.org/software/libc/manual/html_mono/libc.html#index-frexp), this decomposes a given integer value `x` into an integer coefficient `c` and an integral power of two `n` such that
<code>c * 2<sup>n</sup> = x</code>

`ldexp` is also provided as an inverse function for convenience.

### Methods

#### `intexp(integer)`
Returns `[coefficient, exponent]`
e.g.
```javascript
const {intexp} = require('intexp');

const decomposed = intexp(4864) // [19, 8]
```

#### `ldexp(coefficient, exponent)`
Returns integer given coefficient and exponent.
e.g.
```javascript
const {ldexp} = require('intexp');

const int = ldexp(19, 8) // 4864
```

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