Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

💥 Implement wad_ln and wad_exp Functions & wad_cbrt Refactor #91

Merged
merged 20 commits into from
Mar 10, 2023

Conversation

pcaversaccio
Copy link
Owner

@pcaversaccio pcaversaccio commented Mar 8, 2023

🕓 CHANGELOG

Closes #92. This PR introduces two new wad functions:

  • wad_ln: Calculates the natural logarithm of a signed integer with a precision of 1e18. Note that it returns 0 if given 0. Furthermore, this function consumes about 1,400 to 1,650 gas units depending on the value of x.
  • wad_exp: Calculates the natural exponential function of a signed integer with a precision of 1e18. Note that this function consumes about 810 gas units.

♻️ Refactoring

  • Due to gas efficiency reasons, we directly use 🐍 snekmate's log_2 function in the internal calculation of wad_cbrt.
  • We fix a typo in the NatSpec @return comment of the function int256_average.
  • We change the logical sequence order of the math functions (including the test functions sequence).
  • We add additional version-based links to the CHANGELOG entries.

🔁 Dependencies

  • We add solmate as a submodule.
  • We add solady as a submodule.
  • We bump all submodules to the latest available commits.

🐶 Cute Animal Picture

image

Signed-off-by: Pascal Marco Caversaccio <pascal.caversaccio@hotmail.ch>
Signed-off-by: Pascal Marco Caversaccio <pascal.caversaccio@hotmail.ch>
Signed-off-by: Pascal Marco Caversaccio <pascal.caversaccio@hotmail.ch>
@pcaversaccio pcaversaccio added feature 💥 New feature or request dependencies 🔁 Pull requests that update a dependency file refactor/cleanup ♻️ Code refactorings and cleanups labels Mar 8, 2023
@pcaversaccio pcaversaccio added this to the 0.0.2 milestone Mar 8, 2023
@pcaversaccio pcaversaccio self-assigned this Mar 8, 2023
@pcaversaccio pcaversaccio changed the title 💥 Implement wad_ln and wad_exp Functions 💥 Implement wad_ln and wad_exp Functions & wad_cbrt Refactor Mar 8, 2023
@pcaversaccio pcaversaccio changed the title 💥 Implement wad_ln and wad_exp Functions & wad_cbrt Refactor 💥 Implement wad_ln and wad_exp Functions & wad_cbrt Refactor Mar 8, 2023
Signed-off-by: Pascal Marco Caversaccio <pascal.caversaccio@hotmail.ch>
Signed-off-by: Pascal Marco Caversaccio <pascal.caversaccio@hotmail.ch>
Signed-off-by: Pascal Marco Caversaccio <pascal.caversaccio@hotmail.ch>
Signed-off-by: Pascal Marco Caversaccio <pascal.caversaccio@hotmail.ch>
Signed-off-by: Pascal Marco Caversaccio <pascal.caversaccio@hotmail.ch>
Signed-off-by: Pascal Marco Caversaccio <pascal.caversaccio@hotmail.ch>
Signed-off-by: Pascal Marco Caversaccio <pascal.caversaccio@hotmail.ch>
Signed-off-by: Pascal Marco Caversaccio <pascal.caversaccio@hotmail.ch>
Signed-off-by: Pascal Marco Caversaccio <pascal.caversaccio@hotmail.ch>
Signed-off-by: Pascal Marco Caversaccio <pascal.caversaccio@hotmail.ch>
@pcaversaccio pcaversaccio marked this pull request as ready for review March 9, 2023 11:29
Signed-off-by: Pascal Marco Caversaccio <pascal.caversaccio@hotmail.ch>
Signed-off-by: Pascal Marco Caversaccio <pascal.caversaccio@hotmail.ch>
Signed-off-by: Pascal Marco Caversaccio <pascal.caversaccio@hotmail.ch>
Signed-off-by: Pascal Marco Caversaccio <pascal.caversaccio@hotmail.ch>
Signed-off-by: Pascal Marco Caversaccio <pascal.caversaccio@hotmail.ch>
Copy link
Owner Author

@pcaversaccio pcaversaccio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM :) - merging after all fuzz tests have passed 🥳

@pcaversaccio pcaversaccio merged commit 7117bac into main Mar 10, 2023
@pcaversaccio pcaversaccio deleted the math/wad branch March 10, 2023 09:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies 🔁 Pull requests that update a dependency file feature 💥 New feature or request refactor/cleanup ♻️ Code refactorings and cleanups
Projects
None yet
Development

Successfully merging this pull request may close these issues.

💥 Add wad_ln and wad_exp Functions to Math Contract
1 participant