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

use geometric series formula #470

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

etienneld
Copy link

@etienneld etienneld commented Oct 3, 2024

No description provided.

@bdon
Copy link
Member

bdon commented Oct 3, 2024

Any description? Can you include the comparison here? #134

@etienneld
Copy link
Author

etienneld commented Oct 3, 2024

Hi Brandon, this PR refactors tzValues calculation to leverage geometric series formula

  • Replaced the manual lookup table for tzValues with a direct formula based on the properties of a geometric series.
  • The formula (4^z - 1) / (4 - 1) efficiently computes the same values, eliminating the need for a hardcoded array.
  • This approach simplifies code maintenance.

https://www.wolframalpha.com/input?i=Sum%5B2%5Ei+*+2%5Ei%2C+%7Bi%2C+0%2C+n+-+1%7D%5D

@etienneld
Copy link
Author

This change focuses on maintainability rather than performance optimization.

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