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
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.
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
Install the @prb/math package with a Node.js package manager, such as Bun.
Add @prb/math/=node_modules/@prb/math/ to remappings.txt.
Import the required SD59x18 or UD60x18 symbols from the corresponding PRBMath source file.
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.
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.

