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.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_metadata
by removing the setting (abdf0b) (@PaulRBerg) - Install
prb-test
andforge-std
as Node.js packages (#211) (@andreivladbrg, @PaulRBerg) - Update import paths to include
src
(#210) (@PaulRBerg) - Update NatSpec for
UD60x18.avg
function (#213) (@ericglau) - Update NatSpec for
PRBMath_SD59x18_Powu_Overflow
custom error (#194) (@DaniPopes) - Make Node.js the default installation option (@PaulRBerg)
- Include
test/utils
in 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/test
totest/utils
(@PaulRBerg) - Improve documentation (@PaulRBerg)
- Provide silent
bound
utils (@PaulRBerg)
4.0.0 - 2023-04-13
- Breaking: Rename
fromSD590x18
,fromUD60x18
,toSD59x18
, andtoUD60x18
toconvert
(@PaulRBerg) - Breaking: Rename
Core.sol
toCommon.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
mulDiv
rounds 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
lpotdod
and its flipped counterpart inCommon.mulDiv
(@PaulRBerg) - Open pragma in test assertions and utils (@PaulRBerg)
- Reorder statements in
Common.mulDiv18
(@PaulRBerg) - Rename
Common.prbExp2
toCommon.exp2
(@PaulRBerg) - Rename
Common.prbSqrt
toCommon.sqrt
(@PaulRBerg) - Rename
Assertions
toPRBMathAssertions
(@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
unwrap
instead of importedunwrap
(@PaulRBerg) - Use long names in named imports (@PaulRBerg)
- Add
EXP_MAX_INPUT
andEXP2_MAX_INPUT
constants, and use them inexp
andexp2
(@PaulRBerg) - Add
UNIT_SQUARED
and 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
pow
inUD60x18
by 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.wrap
directly 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
Assertions
toPRBMathAssertions
in a backward-compatible way (@PaulRBerg) - Upgrade Node.js package dependencies (@PaulRBerg)
- Add casting utilities for PRBMath types and
uint128
anduint40
(@PaulRBerg) - Add more constants in
SD1x18
andUD2x18
(@PaulRBerg) - Add
PRBMathUtils
contract with test utils (@PaulRBerg) - Add test assertions overloads with
err
param (@PaulRBerg) - Add typed versions of
bound
test util (@PaulRBerg) - Add
wrap
andunwrap
inSD1x18
andUD2x18
(@PaulRBerg) - Expose
unwrap
viausing 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
SD1x18
andUD2x18
assertions (@PaulRBerg)
3.1.0 - 2022-12-13
- Add value types
SD1x18
andUD2x18
(@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
SCALE
toUNIT
(4d3658
) (@PaulRBerg) - Always truncate instead of rounding up in multiplication functions (21fb32) (@PaulRBerg)
- Change license to MIT (@PaulRBerg)
- Check if
y
is zero ingm
(5b585c
) (@PaulRBerg) - Optimize
avg
by using the SWAR technique (#89) (@PaulRBerg) - Optimize
div
andmulDivSigned
by wrapping unary operations in unchecked blocks (a69b4b
) (@PaulRBerg) - Optimize
exp2
by batching bit checks (#77) (@k06a) - Optimize
msb
by using assembly (#135) (@t4sk, @PaulRBerg) - Optimize result assignment in
powu
(673802) (@PaulRBerg) - Rename
fromInt
totoSD59x18
andtoInt
tofromSD59x18
(a69b4b
) (@PaulRBerg) - Rename
fromUint
totoUD60x18
andtoUint
tofromUD60x18
(a69b4b
) (@PaulRBerg) - Rename
mostSignificantBit
tomsb
(a69b4b
) (@PaulRBerg) - Rename
mulDivFixedPoint
tomulDiv18
(4c5430
) (@PaulRBerg) - Rename
PRBMath.sol
toCore.sol
(1b82ea
) (@PaulRBerg) - Rename shared
sqrt
inprbSqrt
(1b82ea
) (@PaulRBerg) - Rename shared
exp2
inprbExp2
(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
SD59x18
andUD60x18
(@PaulRBerg) - Implement conversion and helper functions for the user defined value types (@PaulRBerg)
- Breaking: Delete the
e
andpi
functions (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
exp
NatSpec comments (#119) (@PaulRBerg)
2.5.0 - 2022-03-08
- Change the package name from
prb-math
to@prb/math
(@PaulRBerg) - Update links to repository (@PaulRBerg)
- Upgrade to
mathjs
v10.4.0 (@PaulRBerg)
2.4.3 - 2022-02-02
- Peer dependency version for
mathjs
(@PaulRBerg)
2.4.2 - 2022-02-02
- Upgrade to
mathjs
v10.1.1 (@PaulRBerg)
- Fix typo in comment in
sqrt
(#67 (@transmissions11)
2.4.1 - 2021-10-27
- Upgrade to
@ethersproject/bignumber
v5.5.0 (@PaulRBerg)
- Set peer dependencies (@PaulRBerg)
2.4.0 - 2021-10-20
@ethersproject/bignumber
,decimal.js
,evm-bn
, andmathjs
as normal deps (@PaulRBerg)- Ship JavaScript source maps with the npm package (@PaulRBerg)
- Americanize spellings in NatSpec comments (@PaulRBerg)
- Move everything from the
prb-math.js
package toprb-math
(@PaulRBerg) - Polish NatSpec comments in
avg
function (@PaulRBerg) - Use underscores in number literals (@PaulRBerg)
- Fix bug in the
powu
function of thePRBMathSD59x18
contract, which caused the result to be positive even if the base was negative (@PaulRBerg) - Fix minor bug in the
avg
function of thePRBMathSD59x18
contract, 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
@param
tags in custom errors' NatSpec (@PaulRBerg)
2.1.0 - 2021-06-27
- Define the upper limit as
MAX_UD60x18 / SCALE
in thesqrt
function (@PaulRBerg) - Define
xValue
var to avoid readingx.value
multiple times (@PaulRBerg) - Move
SCALE > prod1
check at the top of themulDivFixedPoint
function (@PaulRBerg) - Refer to
add
function operands as summands (@PaulRBerg) - Refer to
sub
function operands as minuend and subtrahend (@PaulRBerg) - Rename
rUnsigned
var torAbs
(@PaulRBerg) - Set minimum compiler pragma to
>=0.8.4
(@PaulRBerg) - Use
MIN_SD59x18
instead oftype(int256).min
where appropriate (@PaulRBerg)
- Add Solidity v0.8.4 custom errors (@PaulRBerg)
- Remove stale
hardhat/console.sol
import (@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
log10
inPRBMathUD60x18Typed.sol
which made the result inaccurate when the input was a multiple of 10 (@PaulRBerg)
2.0.0 - 2021-06-14
- Breaking: Rename
PRBMathCommon.sol
toPRBMath.sol
(@PaulRBerg) - Increase the accuracy of
exp2
by using the 192.64-bit format instead of 128.128-bit (@PaulRBerg) - Set named parameter instead of returning result in
pow
functions (@PaulRBerg) - Update gas estimates for
exp
andexp2
(@PaulRBerg)
- Add
add
andsub
functions in the typed libraries (@PaulRBerg) - Add types flavors of the library:
PRBMathSD59x18Typed.sol
andPRBMathUD60x18Typed.sol
(@PaulRBerg) - Document gas estimates for
fromInt
,fromUint
,pow
,toInt
andtoUInt
(@PaulRBerg) - Structs
PRBMath.SD59x18
andPRBMath.UD60x18
, simple wrappers to indicate that the variables are fixed-point numbers (@PaulRBerg)
- Bug in
log10
which 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
pow
function topowu
(@PaulRBerg) - Speed up
exp2
by simplifying the integer part calculations (@PaulRBerg) - Use the fixed-point format in NatSpec comments (@PaulRBerg)
- Add new convertor functions
fromInt
andtoInt
inPRBMathSD59x18.sol
(@PaulRBerg) - Add new convertor functions
fromUint
andtoUint
inPRBMathUD60x18.sol
(@PaulRBerg) - Add new function
mulDivSigned
inPRBMathCommon.sol
(@PaulRBerg) - Add new function
pow
inPRBMathSD59x18.sol
andPRBMathUD60x18.sol
(@PaulRBerg)
- Fix minor typos in NatSpec comments (@PaulRBerg)
1.0.5 - 2021-04-24
- Speed up the
exp2
function in PRBMathCommon.sol by simplifying the integer part calculation (@PaulRBerg)) - Use
SCALE
instead of the 1e18 literal inPRBMathCommon.sol
(@PaulRBerg)
- Add link to StackExchange answer in
exp2
NatSpec comments (@PaulRBerg)
1.0.4 - 2021-04-20
- Optimize the
pow
function inPRBMathUD60x18
by callingmulDivFixedPoint
directly (@PaulRBerg)
1.0.3 - 2021-04-20
- Fix typos in NatSpec comments (@PaulRBerg)
- Fix typo in example in README (@PaulRBerg)
- Remove
SCALE_LPOTD
andSCALE_INVERSE
constants inPRBMathSD59x18
(@PaulRBerg)
1.0.2 - 2021-04-19
- Remove stale
SCALE_LPOTD
andSCALE_INVERSE
constants 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)