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.
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 down 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)
@param
tags for 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
sqrt
function NatSpec (@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
- Increase the accuracy of
exp2
by using the 192.64-bit format instead of 128.128-bit (@PaulRBerg) - Rename
PRBMathCommon.sol
toPRBMath.sol
(@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 in PRBMathUD60x18.sol 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 in PRBMathSD59x18.sol (@PaulRBerg)
1.0.2 - 2021-04-19
- Remove stale
SCALE_LPOTD
andSCALE_INVERSE
constants in PRBMathUD60x18.sol (@PaulRBerg)
1.0.1 - 2021-04-19
- Change in the README (@PaulRBerg)
1.0.0 - 2021-04-19
- First release of the library (@PaulRBerg)