I am trying to understand an article about lossless compression of floating point numbers and get stuck at one specific stage, in which the authors are signed with an integer from a certain range to half the size, losing the information that I think is required. I have a feeling that the authors use some standard technique, so obvious to their audience, that they do not bother to explain, but for me it is completely opaque.
The value that "adds up" is the difference between two 23-bit positive integers (predicted and actual floating-point mantissas) that lies between 1 - 2 23 and 2 23 - 1. Authors move numbers with the highest values (negative and positive) "inward", so the resulting range is half the size, and each number (except 0) displays two possible values from the original range. This makes me wonder how the process should be canceled in order to determine the initial value. In the authors' own words:
We calculate the signed corrector, which is the shortest modulo 2 23 and a number kthat defines the smallest interval (1-2 k 2 k ) into which this corrector falls. Then this number k, which is in the range from 0 to 22, is compressed [...]. Finally, the compressed signed equalizer bits k + 1are compressed.
Pseudo-code for this is specified as:
void comp mantissa(int expo, int a, int p) {
int c = a - p;
if (c <= -(1<<22)) c += 1<<23;
else if (c > (1<<22)) c -= 1<<23;
int k = 0;
int c1 = (c < 0 ? -c : c);
while (c1) { c1 = c1 >> 1; k++ }
if (k && (c == 1<<(k-1))) k--;
}
Ignoring the actual compression method, the output consists of cand k. What I am not getting is: How to restore the original cfrom cand kwhen the "wrap c into" part only maps half of the potential range to the other half? I tried this on paper with 4 instead of 23 bits, and I just don't get it.