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

BinaryInteger/entropy() as first appendix index? #154

Open
oscbyspro opened this issue Dec 18, 2024 · 1 comment
Open

BinaryInteger/entropy() as first appendix index? #154

oscbyspro opened this issue Dec 18, 2024 · 1 comment
Labels
addition oh, so shiny! maybe to do, or not to do? subtraction huh? where did it go?

Comments

@oscbyspro
Copy link
Owner

oscbyspro commented Dec 18, 2024

Currently, the BinaryInteger/entropy() returns the number of bits needed to arbitrarily represent a binary integer. This number includes the appendix bit. In other words, it may return a value in the range 1...IX.max. In the limit of things, this is a bit awkward because IX.max+1 is a simpler cutoff point as it is a power of 2. Like, you can fit IX.max+1 bits exactly in an array of 8-bit elements. So it would perhaps be simpler if it instead returned the index of the first appendix bit (i.e. one less than the current value). Just a thought at this point.

@oscbyspro oscbyspro added addition oh, so shiny! maybe to do, or not to do? subtraction huh? where did it go? labels Dec 18, 2024
@oscbyspro
Copy link
Owner Author

oscbyspro commented Dec 18, 2024

Another observation is that the exclusive entropy definition, the number of ascending ones, and the number of descending zeros overflow at the same index in the following table. By contrast the inclusive entropy definition would overflow one index earlier (assuming the table continues to that point).

pattern inclusive exclusive ascending 1s descending 0s
........|0 1 0 0 log2(&0+1) - 0
1.......|0 2 1 1 log2(&0+1) - 1
11......|0 3 2 2 log2(&0+1) - 2
111.....|0 4 3 3 log2(&0+1) - 3
1111....|0 5 4 4 log2(&0+1) - 4
11111...|0 6 5 5 log2(&0+1) - 5
111111..|0 7 6 6 log2(&0+1) - 6
1111111.|0 8 7 7 log2(&0+1) - 7
11111111|0 9 8 8 log2(&0+1) - 8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
addition oh, so shiny! maybe to do, or not to do? subtraction huh? where did it go?
Projects
None yet
Development

No branches or pull requests

1 participant