Skip to content

Conversation

@engn33r
Copy link
Contributor

@engn33r engn33r commented Dec 14, 2023

Description

This is the same optimization described in pcaversaccio/snekmate#189

This PR is for a very small optimization that is possible by increasing the range of values that will take the short logic path of expWad() and return 0. I am not sure how the previously chosen value of -42139678854452767551 was selected, but these tests demonstrate the actual turning point when the result of the current expWad() implementation transitions from 1 to 0.

function testExpWad() public {
    assertEq(FixedPointMathLib.expWad(-41446531673892822312), 1);
    assertEq(FixedPointMathLib.expWad(-41446531673892822313), 0);
}

Checklist

Ensure you completed all of the steps below before submitting your pull request:

  • Ran forge fmt?
  • Ran forge snapshot?
  • Ran forge test?

Pull requests with an incomplete checklist will be thrown out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants