DDRM wrote: ↑Sat 08 Oct 2022, 15:00
As I understand it, it is possible to pack two (potentially) 11 bit numbers into 20 bits because we know that at least one of them needs at most 9 bits (edit: if the other is 11 bits: both could be 10 bits), since if one of them exceeds 1023 then the other must be less than 512. The problem arises because we don't know which values (if either) are big!
You've rather confused me because you are stating the requirements for the
encoding function which I have already created and tested! There is no "problem" in the sense in which you describe it, because I have already solved it (it was quite straightforward, hence why I was able to manage it without help, even in my current condition).
I can make a trivial improvement to your (already fast and efficient!) encoding function by taking the final "-S%" inside the first part of the expression:
T = (2879 - S%)*S%/2 +F%
OK, noted, thanks.
The choice between /, DIV, and >> is thus presumably one of speed?
No active "choice" was made, I just wanted an integer division and that is what DIV does. Using / would mean the two integer values first being converted to floating-point, a floating=point division then being performed, and finally the quotient being truncated and converted to an integer.
This expression is obviously a quadratic
There speaks a mathematician - nothing about it is "obvious" to me at all! But if what you are saying is that it is therefore insoluble other than by iterative means then that in itself is a valuable (if annoying) conclusion. Might there at least be some way of reducing the number of iterative steps required?
I am sorry that my post has obviously caused a great deal of annoyance - if not anger. Clearly I should never have asked the question in the first place; please delete the entire thread. I am unfortunately not able to post to the discussion group, but I may try the Facebook group because that has (so far) remained friendly.