All notable changes to this project will be documented in this file.
The format is based on Common Changelog, and this project adheres to Semantic Versioning.
4.1.1 - 2026-02-11
- Rename
DOUBLE_UNITlocal variable todoubleUnitinSD59x18.log2andUD60x18.log2(#261) - Add LaTeX property specifications for
msbandsqrtinCommon.sol(#267)
4.1.0 - 2024-10-21
- Make domain bound specs more visually descriptive (#239) (@PaulRBerg)
- Update requirement spec in
UD60x18.log2(#239) (@PaulRBerg) - Use return instead of param for return parameter NatSpec documentation (#241) (@ericglau)
- Add UD21x18 and SD21x18 types (#212) (@andreivladbrg, @PaulRBerg)
- Remove adjacent castings (#237) (@PaulRBerg)
4.0.3 - 2024-06-14
- Change visibility of
bound(#216) (@PaulRBerg) - Switch to Bun for dependency management (#218) (@PaulRBerg)
- Remove dependency on
prb-test(#222) (@smol-ninja)
- Fix types for
uUNIT(970aa90) (@PaulRBerg) - Return zero for very small inputs passed to
exp(#229) (@0x2me)
4.0.2 - 2023-12-04
- Enable
cbor_metadataby removing the setting (abdf0b) (@PaulRBerg) - Install
prb-testandforge-stdas Node.js packages (#211) (@andreivladbrg, @PaulRBerg) - Update import paths to include
src(#210) (@PaulRBerg) - Update NatSpec for
UD60x18.avgfunction (#213) (@ericglau) - Update NatSpec for
PRBMath_SD59x18_Powu_Overflowcustom error (#194) (@DaniPopes) - Make Node.js the default installation option (@PaulRBerg)
- Include
test/utilsin Node.js package (#211) (@andreivladbrg, @PaulRBerg)
- Remove git submodules (#211) (@andreivladbrg, @PaulRBerg)
- Remove the dummy re-exports in
src/test(#211) (@andreivladbrg)
4.0.1 - 2023-05-28
- Bump submodules (@PaulRBerg)
- Clarify rounding modes (@PaulRBerg)
- Move test utils from
src/testtotest/utils(@PaulRBerg) - Improve documentation (@PaulRBerg)
- Provide silent
boundutils (@PaulRBerg)
4.0.0 - 2023-04-13
- Breaking: Rename
fromSD590x18,fromUD60x18,toSD59x18, andtoUD60x18toconvert(@PaulRBerg) - Breaking: Rename
Core.soltoCommon.sol(@PaulRBerg) - Breaking: Set minimum compiler pragma to
>=0.8.19(@PaulRBerg) - Bump Node.js dependencies (@PaulRBerg)
- Bump submodules (@PaulRBerg)
- Clarify rounding modes (6bb53ea) (@PaulRBerg)
- Clarify that
mulDivrounds toward zero (cda291) (@PaulRBerg) - Fix typo in code snippet in README (#180) (@cygaar)
- Format contracts with Forge Formatter (@PaulRBerg)
- Improve writing and formatting in documentation (@PaulRBerg)
- Make a distinction between
lpotdodand its flipped counterpart inCommon.mulDiv(@PaulRBerg) - Open pragma in test assertions and utils (@PaulRBerg)
- Reorder statements in
Common.mulDiv18(@PaulRBerg) - Rename
Common.prbExp2toCommon.exp2(@PaulRBerg) - Rename
Common.prbSqrttoCommon.sqrt(@PaulRBerg) - Rename
AssertionstoPRBMathAssertions(@PaulRBerg) - Return base when exponent is unit in
pow(#182) (@PaulRBerg) - Return unit when base is unit in
pow(#182) (@PaulRBerg) - Switch to Pnpm for Node.js package management (@PaulRBerg)
- Use bound
unwrapinstead of importedunwrap(@PaulRBerg) - Use long names in named imports (@PaulRBerg)
- Add
EXP_MAX_INPUTandEXP2_MAX_INPUTconstants, and use them inexpandexp2(@PaulRBerg) - Add
UNIT_SQUAREDand use it instead of the hard-coded value (@PaulRBerg) - Add user-defined operators (#168) (@Amxx,@PaulRBerg)
- Add unary operator (#173) (@Lumyo,@PaulRBerg)
- Expand domain of
powinUD60x18by allowing inputs lower thanUNIT(#182) (@PaulRBerg)
- Remove development-related Node.js dependencies (@PaulRBerg)
- Remove "memory-safe" annotation in test assertions (@PaulRBerg)
- Remove problematic src/=src/ remapping (#41) (@PaulRBerg)
- Remove superfluous threshold check in
SD59x19.exp(@PaulRBerg)
- Fix bit mask in
Common.exp2(#179) (@andreivladbrg)
3.3.2 - 2023-03-19
- Use
ValueType.wrapdirectly in casting functions (@PaulRBerg)
3.3.1 - 2023-03-17
- Bump submodules (@PaulRBerg)
3.3.0 - 2023-02-06
- Improve documentation (@PaulRBerg)
- Improve names of custom errors and functions (@PaulRBerg)
- Optimize assembly usage by annotating assembly blocks with the "memory-safe" dialect (@PaulRBerg)
- Modularize code by splitting it into multiple categories: casting, constants, conversions, errors, helpers, math, and value types (@PaulRBerg)
- Rename
AssertionstoPRBMathAssertionsin a backward-compatible way (@PaulRBerg) - Upgrade Node.js package dependencies (@PaulRBerg)
- Add casting utilities for PRBMath types and
uint128anduint40(@PaulRBerg) - Add more constants in
SD1x18andUD2x18(@PaulRBerg) - Add
PRBMathUtilscontract with test utils (@PaulRBerg) - Add test assertions overloads with
errparam (@PaulRBerg) - Add typed versions of
boundtest util (@PaulRBerg) - Add
wrapandunwrapinSD1x18andUD2x18(@PaulRBerg) - Expose
unwrapviausing for ... global(@PaulRBerg)
3.2.0 - 2022-12-13
- Add assertions for array comparisons (@PaulRBerg)
- Delete assertions that have an "err" argument (@PaulRBerg)
- Match types for
SD1x18andUD2x18assertions (@PaulRBerg)
3.1.0 - 2022-12-13
- Add value types
SD1x18andUD2x18(@PaulRBerg)
3.0.0 - 2022-11-29
- Breaking: Refactor the libraries into free functions and user defined value types (
a69b4b) (@PaulRBerg) - Breaking: Set minimum compiler pragma to
>=0.8.13(a69b4b) (@PaulRBerg) - Breaking: Rename
SCALEtoUNIT(4d3658) (@PaulRBerg) - Always truncate instead of rounding up in multiplication functions (21fb32) (@PaulRBerg)
- Change license to MIT (@PaulRBerg)
- Check if
yis zero ingm(5b585c) (@PaulRBerg) - Optimize
avgby using the SWAR technique (#89) (@PaulRBerg) - Optimize
divandmulDivSignedby wrapping unary operations in unchecked blocks (a69b4b) (@PaulRBerg) - Optimize
exp2by batching bit checks (#77) (@k06a) - Optimize
msbby using assembly (#135) (@t4sk, @PaulRBerg) - Optimize result assignment in
powu(673802) (@PaulRBerg) - Rename
fromInttotoSD59x18andtoInttofromSD59x18(a69b4b) (@PaulRBerg) - Rename
fromUinttotoUD60x18andtoUinttofromUD60x18(a69b4b) (@PaulRBerg) - Rename
mostSignificantBittomsb(a69b4b) (@PaulRBerg) - Rename
mulDivFixedPointtomulDiv18(4c5430) (@PaulRBerg) - Rename
PRBMath.soltoCore.sol(1b82ea) (@PaulRBerg) - Rename shared
sqrtinprbSqrt(1b82ea) (@PaulRBerg) - Rename shared
exp2inprbExp2(1b82ea) (@PaulRBerg) - Revert with inputs instead of computed value custom errors (@PaulRBerg)
- Return base if exponent is one in
pow(977d43) (@PaulRBerg) - Format mathematical expressions using LaTeX (@PaulRBerg)
- Improve wording and formatting in comments, NatSpec documentation, and README (@PaulRBerg)
- Add constants for E and PI (
422d87) (@PaulRBerg) - Add simple PRBTest-based typed assertions for testing in Foundry (
ddb084) (@PaulRBerg) - Add user defined value types
SD59x18andUD60x18(@PaulRBerg) - Implement conversion and helper functions for the user defined value types (@PaulRBerg)
- Breaking: Delete the
eandpifunctions (422d87) (@PaulRBerg) - Breaking: Remove JavaScript SDK and all paraphernalia (
1b82ea) (@PaulRBerg)
- Fix incorrect hard-coded value in
sqrt(#91) (@Amxx, @nonergodic) - Fix upper boundary specified in
expNatSpec comments (#119) (@PaulRBerg)
2.5.0 - 2022-03-08
- Change the package name from
prb-mathto@prb/math(@PaulRBerg) - Update links to repository (@PaulRBerg)
- Upgrade to
mathjsv10.4.0 (@PaulRBerg)
2.4.3 - 2022-02-02
- Peer dependency version for
mathjs(@PaulRBerg)
2.4.2 - 2022-02-02
- Upgrade to
mathjsv10.1.1 (@PaulRBerg)
- Fix typo in comment in
sqrt(#67 (@transmissions11)
2.4.1 - 2021-10-27
- Upgrade to
@ethersproject/bignumberv5.5.0 (@PaulRBerg)
- Set peer dependencies (@PaulRBerg)
2.4.0 - 2021-10-20
@ethersproject/bignumber,decimal.js,evm-bn, andmathjsas normal deps (@PaulRBerg)- Ship JavaScript source maps with the npm package (@PaulRBerg)
- Americanize spellings in NatSpec comments (@PaulRBerg)
- Move everything from the
prb-math.jspackage toprb-math(@PaulRBerg) - Polish NatSpec comments in
avgfunction (@PaulRBerg) - Use underscores in number literals (@PaulRBerg)
- Fix bug in the
powufunction of thePRBMathSD59x18contract, which caused the result to be positive even if the base was negative (@PaulRBerg) - Fix minor bug in the
avgfunction of thePRBMathSD59x18contract, which rounded down the result instead of up when the intermediary sum was negative (@PaulRBerg)
2.3.0 - 2021-09-18
- The CHANGELOG file in the npm package bundle (@PaulRBerg)
- License from "WTFPL" to "Unlicense" (@PaulRBerg)
- Polish README (@PaulRBerg)
- Typos in comments (@PaulRBerg)
- Remove stale "resolutions" field in
package.json(@PaulRBerg)
2.2.0 - 2021-06-27
- Add contract name prefix to custom errors (@PaulRBerg)
- Remove
@paramtags in custom errors' NatSpec (@PaulRBerg)
2.1.0 - 2021-06-27
- Define the upper limit as
MAX_UD60x18 / SCALEin thesqrtfunction (@PaulRBerg) - Define
xValuevar to avoid readingx.valuemultiple times (@PaulRBerg) - Move
SCALE > prod1check at the top of themulDivFixedPointfunction (@PaulRBerg) - Refer to
addfunction operands as summands (@PaulRBerg) - Refer to
subfunction operands as minuend and subtrahend (@PaulRBerg) - Rename
rUnsignedvar torAbs(@PaulRBerg) - Set minimum compiler pragma to
>=0.8.4(@PaulRBerg) - Use
MIN_SD59x18instead oftype(int256).minwhere appropriate (@PaulRBerg)
- Add Solidity v0.8.4 custom errors (@PaulRBerg)
- Remove stale
hardhat/console.solimport (@PaulRBerg) - Remove stale caveat in the NatSpec for
sqrt(@PaulRBerg)
2.0.1 - 2021-06-16
- Mention the new typed flavors in the README (@PaulRBerg)
- Code snippet for the UD60x18Typed consumer in the README (@PaulRBerg)
- English typos in NatSpec comments (#40) (@ggviana)
- Minor bug in
log10inPRBMathUD60x18Typed.solwhich made the result inaccurate when the input was a multiple of 10 (@PaulRBerg)
2.0.0 - 2021-06-14
- Breaking: Rename
PRBMathCommon.soltoPRBMath.sol(@PaulRBerg) - Increase the accuracy of
exp2by using the 192.64-bit format instead of 128.128-bit (@PaulRBerg) - Set named parameter instead of returning result in
powfunctions (@PaulRBerg) - Update gas estimates for
expandexp2(@PaulRBerg)
- Add
addandsubfunctions in the typed libraries (@PaulRBerg) - Add types flavors of the library:
PRBMathSD59x18Typed.solandPRBMathUD60x18Typed.sol(@PaulRBerg) - Document gas estimates for
fromInt,fromUint,pow,toIntandtoUInt(@PaulRBerg) - Structs
PRBMath.SD59x18andPRBMath.UD60x18, simple wrappers to indicate that the variables are fixed-point numbers (@PaulRBerg)
- Bug in
log10which made the result incorrect when the input was not a multiple of 10 (@PaulRBerg) - Typos in NatSpec comments (@PaulRBerg)
1.1.0 - 2021-05-07
This release was yanked because it was accidentally published with the wrong version number.
- Rename the previous
powfunction topowu(@PaulRBerg) - Speed up
exp2by simplifying the integer part calculations (@PaulRBerg) - Use the fixed-point format in NatSpec comments (@PaulRBerg)
- Add new converter functions
fromIntandtoIntinPRBMathSD59x18.sol(@PaulRBerg) - Add new converter functions
fromUintandtoUintinPRBMathUD60x18.sol(@PaulRBerg) - Add new function
mulDivSignedinPRBMathCommon.sol(@PaulRBerg) - Add new function
powinPRBMathSD59x18.solandPRBMathUD60x18.sol(@PaulRBerg)
- Fix minor typos in NatSpec comments (@PaulRBerg)
1.0.5 - 2021-04-24
- Speed up the
exp2function in PRBMathCommon.sol by simplifying the integer part calculation (@PaulRBerg)) - Use
SCALEinstead of the 1e18 literal inPRBMathCommon.sol(@PaulRBerg)
- Add link to StackExchange answer in
exp2NatSpec comments (@PaulRBerg)
1.0.4 - 2021-04-20
- Optimize the
powfunction inPRBMathUD60x18by callingmulDivFixedPointdirectly (@PaulRBerg)
1.0.3 - 2021-04-20
- Fix typos in NatSpec comments (@PaulRBerg)
- Fix typo in example in README (@PaulRBerg)
- Remove
SCALE_LPOTDandSCALE_INVERSEconstants inPRBMathSD59x18(@PaulRBerg)
1.0.2 - 2021-04-19
- Remove stale
SCALE_LPOTDandSCALE_INVERSEconstants inPRBMathUD60x18(@PaulRBerg)
1.0.1 - 2021-04-19
- Change in the README (@PaulRBerg)
1.0.0 - 2021-04-19
- First release of the library (@PaulRBerg)