# solidity-fixedpoint

> Implements fixed point numbers in Solidity using the Q number format

Latest version **1.0.1** (published 2020-06-05) · GPL-3.0-or-later license · 0 weekly downloads

## Install

```sh
npm install solidity-fixedpoint
pnpm add solidity-fixedpoint
yarn add solidity-fixedpoint
bun add solidity-fixedpoint
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2020-06-05 |
| First published | 2020-06-05 |
| Weekly downloads | 0 |
| License | GPL-3.0-or-later |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=10 |
| Dependencies | 0 |
| Unpacked size | 44 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 3 |
| Author | Will Shahda |
| Maintainers | opz |
| Keywords | ethereum, solidity, math, fixed-point |

## Links

- npm: https://www.npmjs.com/package/solidity-fixedpoint
- Repository: https://github.com/opz/solidity-fixedpoint
- Issues: https://github.com/Uniswap/uniswap-lib/issues
- npm.io page: https://npm.io/package/solidity-fixedpoint

## Alternatives

- [@sindresorhus/slugify](https://npm.io/package/@sindresorhus/slugify.md) — 3.7M weekly downloads
- [solid-js](https://npm.io/package/solid-js.md) — 2.7M weekly downloads
- [expo-glass-effect](https://npm.io/package/expo-glass-effect.md) — 2.5M weekly downloads
- [nanoassert](https://npm.io/package/nanoassert.md) — 780.8K weekly downloads
- [@ffmpeg/ffmpeg](https://npm.io/package/@ffmpeg/ffmpeg.md) — 529.5K weekly downloads

## Recent versions

- 1.0.1 (latest) — 2020-06-05

## README

# Solidity Fixed Point Library

[![Actions Status](https://github.com/opz/solidity-fixedpoint/workflows/CI/badge.svg)](https://github.com/opz/solidity-fixedpoint/actions)
[![npm](https://img.shields.io/npm/v/solidity-fixedpoint)](https://unpkg.com/solidity-fixedpoint@latest/)

Implements fixed point numbers in Solidity using the [Q number format](https://en.wikipedia.org/wiki/Q_(number_format)).

Built off the Uniswap [FixedPoint](https://github.com/Uniswap/uniswap-lib/blob/master/contracts/libraries/FixedPoint.sol) and [Babylonian](https://github.com/Uniswap/uniswap-lib/blob/master/contracts/libraries/Babylonian.sol) libraries developed by [moodysalem](https://github.com/moodysalem).

This library uses the UQ192x64 format to maximize the range of fixed point numbers while keeping the resolution close to the 18 decimal places that is standard for most Solidity contracts.

Uniswap originally used the UQ112x112 format to optimize the variable packing in their contracts.

## Install Dependencies

`npm install`

## Compile Contracts

`npx buidler compile`

## Run Tests

`npx buidler test`

## Contributors

* [@opz](https://github.com/opz) 💻

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