Socket
Socket
Sign inDemoInstall

@prb/math

Package Overview
Dependencies
0
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

4.0.2

Diff

Changelog

Source

[4.0.2] - 2023-12-04

Changed

  • Enable cbor_metadata by removing the setting (abdf0b) (@PaulRBerg)
  • Install prb-test and forge-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)

Added

  • Include test/utils in Node.js package (#211) (@andreivladbrg, @PaulRBerg)

Removed

  • Remove git submodules (#211) (@andreivladbrg, @PaulRBerg)
  • Remove the dummy re-exports in src/test (#211) (@andreivladbrg)
paulrberg
published 4.0.1 •

Changelog

Source

[4.0.1] - 2023-05-28

Changed

  • Bump submodules (@PaulRBerg)
  • Clarify rounding modes (@PaulRBerg)
  • Move test utils from src/test to test/utils (@PaulRBerg)
  • Improve documentation (@PaulRBerg)

Added

  • Provide silent bound utils (@PaulRBerg)
paulrberg
published 4.0.0 •

Changelog

Source

[4.0.0] - 2023-04-13

Changed

  • Breaking: Rename fromSD590x18, fromUD60x18, toSD59x18, and toUD60x18 to convert (@PaulRBerg)
  • Breaking: Rename Core.sol to Common.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 in Common.mulDiv (@PaulRBerg)
  • Open pragma in test assertions and utils (@PaulRBerg)
  • Reorder statements in Common.mulDiv18 (@PaulRBerg)
  • Rename Common.prbExp2 to Common.exp2 (@PaulRBerg)
  • Rename Common.prbSqrt to Common.sqrt (@PaulRBerg)
  • Rename Assertions to PRBMathAssertions (@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 imported unwrap (@PaulRBerg)
  • Use long names in named imports (@PaulRBerg)

Added

  • Add EXP_MAX_INPUT and EXP2_MAX_INPUT constants, and use them in exp and exp2 (@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 in UD60x18 by allowing inputs lower than UNIT (#182) (@PaulRBerg)

Removed

  • 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)

Fixed

  • Fix bit mask in Common.exp2 (#179) (@andreivladbrg)
paulrberg
published 3.3.1 •

Changelog

Source

[3.3.1] - 2023-03-17

Changed

  • Bump submodules (@PaulRBerg)
paulrberg
published 3.3.0 •

Changelog

Source

[3.3.0] - 2023-02-06

Changed

  • 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 to PRBMathAssertions in a backward-compatible way (@PaulRBerg)
  • Upgrade Node.js package dependencies (@PaulRBerg)

Added

  • Add casting utilities for PRBMath types and uint128 and uint40 (@PaulRBerg)
  • Add more constants in SD1x18 and UD2x18 (@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 and unwrap in SD1x18 and UD2x18 (@PaulRBerg)
  • Expose unwrap via using for ... global (@PaulRBerg)
paulrberg
published 3.1.0 •

Changelog

Source

[3.1.0] - 2022-12-13

Added

  • Add value types SD1x18 and UD2x18 (@PaulRBerg)
paulrberg
published 3.2.0 •

Changelog

Source

[3.2.0] - 2022-12-13

Added

  • Add assertions for array comparisons (@PaulRBerg)

Removed

  • Delete assertions that have an "err" argument (@PaulRBerg)

Fixed

  • Match types for SD1x18 and UD2x18 assertions (@PaulRBerg)
paulrberg
published 3.0.0 •

Changelog

Source

[3.0.0] - 2022-11-29

Changed

  • Breaking: Refactor the libraries into free functions and user defined value types ([a69b4b][a69b4b]) (@PaulRBerg)
  • Breaking: Set minimum compiler pragma to >=0.8.13 ([a69b4b][a69b4b]) (@PaulRBerg)
  • Breaking: Rename SCALE to UNIT (4d3658) (@PaulRBerg)
  • Always truncate instead of rounding up in multiplication functions (21fb32) (@PaulRBerg)
  • Change license to MIT (@PaulRBerg)
  • Check if y is zero in gm (5b585c) (@PaulRBerg)
  • Optimize avg by using the SWAR technique (#89) (@PaulRBerg)
  • Optimize div and mulDivSigned by wrapping unary operations in unchecked blocks ([a69b4b][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 to toSD59x18 and toInt to fromSD59x18 ([a69b4b][a69b4b]) (@PaulRBerg)
  • Rename fromUint to toUD60x18 and toUint to fromUD60x18 ([a69b4b][a69b4b]) (@PaulRBerg)
  • Rename mostSignificantBit to msb ([a69b4b][a69b4b]) (@PaulRBerg)
  • Rename mulDivFixedPoint to mulDiv18 (4c5430) (@PaulRBerg)
  • Rename PRBMath.sol to Core.sol ([1b82ea][1b82ea]) (@PaulRBerg)
  • Rename shared sqrt in prbSqrt ([1b82ea][1b82ea]) (@PaulRBerg)
  • Rename shared exp2 in prbExp2 ([1b82ea][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)

Added

  • 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 and UD60x18 (@PaulRBerg)
  • Implement conversion and helper functions for the user defined value types (@PaulRBerg)

Removed

  • Breaking: Delete the e and pi functions (422d87) (@PaulRBerg)
  • Breaking: Remove JavaScript SDK and all paraphernalia ([1b82ea][1b82ea]) (@PaulRBerg)

Fixed

  • Fix incorrect hard-coded value in sqrt (#91) (@Amxx, @nonergodic)
  • Fix upper boundary specified in exp NatSpec comments (#119) (@PaulRBerg)
paulrberg
published 2.5.0 •

Changelog

Source

[2.5.0] - 2022-03-08

Changed

  • Change the package name from prb-math to @prb/math (@PaulRBerg)
  • Update links to repository (@PaulRBerg)
  • Upgrade to mathjs v10.4.0 (@PaulRBerg)
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc