OpenViSTAI · Agents · Blockchain · Crypto
Menu
Developer Tools

PRBMath

PRBMath is an MIT-licensed Solidity library that supplies signed SD59x18 and unsigned UD60x18 fixed-point types, arithmetic, and advanced mathematical functions for smart-contract code.

Independent OpenViST project profile, based on linked sources.

PRBMath — OpenViST project profile in Developer Tools.
OpenViST project illustration. See the linked sources for product details.
Understand the project

Practical overview

When it fits

Use PRBMath when a Solidity contract needs reusable 18-decimal fixed-point calculations, especially for financial or DeFi formulas that require advanced functions or signed values.

Who it is for

  • Solidity developers working on Ethereum or EVM smart contracts
  • DeFi and financial application builders
  • Teams implementing on-chain pricing, valuation, accrual, tokenomics or vesting formulas

Documented uses

  • Represent decimal values with up to 18 fractional digits
  • Perform signed or unsigned fixed-point multiplication and division
  • Apply logarithmic, exponential, power and square-root calculations in Solidity
  • Reuse overflow-safe arithmetic and typed value representations in contract code
Before you choose

Requirements & limits

The repository is public, open source and MIT licensed. Installation instructions cover a Node.js package-manager route and a Forge Git submodule route.

  • Choose SD59x18 when calculations require negative numbers.
  • Choose UD60x18 when values are non-negative; the documentation identifies it as more gas efficient than the signed form.
  • Use Solidity 0.8.19 or later.
  • Foundry users need a remapping when installing through Node.js or Git submodules.
  • Specific-symbol imports are recommended to reduce duplicate-definition and static-analyzer issues in projects with overlapping dependencies.

Check current requirements in the official documentation. Source-based guidance does not mean OpenViST has run or independently tested this project.

Source-based practical guide

Add PRBMath to a Foundry project

Install PRBMath through Node.js and connect it to Foundry with a remapping.

Before you start

  • A Node.js package manager
  • A Foundry-based Solidity project
  • Solidity 0.8.19 or later

Steps

  1. Install the @prb/math package with a Node.js package manager, such as Bun.

  2. Add @prb/math/=node_modules/@prb/math/ to remappings.txt.

  3. Import the required SD59x18 or UD60x18 symbols from the corresponding PRBMath source file.

  4. Use the selected fixed-point type in Solidity contract code.

Expected outcome

The Foundry project can reference PRBMath’s signed or unsigned fixed-point types and functions.

Guide limitations

  • The documented installation steps do not establish deployment or runtime behavior.
  • The library can only be used with Solidity v0.8.19 and above.
Evidence and transparency

Sources & review

Source record details
Source availability
Active
Sources checked
2 October 2026
Original website title
PaulRBerg/prb-math · Official homepage title · retained in its source language

Related options

ABDKMath64x64 — A contrasting fixed-point math library described as using binary numbers.

Solmate — A contrasting Solidity option described as fast and intuitive but lacking type safety.