Advantages | Disadvantages | |
---|---|---|
ABDKMath, Q64.64 | • 64 decimals • should be the most gas efficient: what about casting uint256 => int128? |
• everything in int128 => uint/int conversion necessary • less maintained: last commit February 16, 2023 • difficult to read: everything in binary • no type safety |
PRBMath: QU60.18 | • 18 decimals • faster than ABDKMath for abs , exp , exp2 , gm , inv , ln , log2 • better maintained than ABDK: commit December 26, 2024 • no conversion needed • type safety |
slower than ABDKMath for avg , div , mul , powu and sqrt |
FullMath (Uniswap) | • programmable decimals: 512bits support => exact decimals (96 or 128 in Uni) • robustly tested • very light: mul & div • highly optimized version of SNX |
• no advanced functions • no type safety |
Ray / SNX SafeDecimal Math | • super simple: mul & div (RAY) • robustly tested |
• no advanced functions • less optimized and less precise than FullMath • no type safety |
Solady's | • advanced functions: ln, log, log2, ... • full mulDiv |
• primarily WAD, except apparently full div, logS, rpow & sqrt • no type safety |
DSMath (DappHub, Maker) | • lightweight: basic functions + rpow (power on RAY) • mul, div, min, max |
• RAY or WAD only, so max 9 extra decimals • no type safety |
FixidityLib | / | too old, ^0.5.0 |
Created
April 21, 2025 22:54
-
-
Save Theo6890/b12614db116bb8ebb8ad071e69acc94b to your computer and use it in GitHub Desktop.
Math lib solidity
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment