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

Fix rounding errors on log2 of large numbers #8

Merged
merged 10 commits into from
Jul 30, 2022
Merged

Fix rounding errors on log2 of large numbers #8

merged 10 commits into from
Jul 30, 2022

Conversation

hornc
Copy link
Owner

@hornc hornc commented Jul 26, 2022

Fixes #7

Replaces math.floor(math.log(x, 2)) with a custom version which does not suffer from rounding errors on large numbers.

bct() is still recursive, this has the effect that the data string will be limited to ~1000 bits due to Python's recursion limit.
The bit string could be built by stepping through the string length (s()) and appending each symbol to avoid the recursion if needed.

The program string is not converted in normal operation, so that can get as large as it needs to and will be treated correctly, arithmetically.

@hornc hornc changed the title Debugging for #7 Fix rounding errors on log2 of large numbers Jul 30, 2022
@hornc hornc merged commit d377a5c into master Jul 30, 2022
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.

Program data wraps incorrectly for some programs
1 participant