Can somebody please elaborate that how encoding length of z is defined in the statement below:

24 Views Asked by At

Given a rational number $z = p/q$ with $p ∈ Z, q ∈ Z_{≥1}, gcd(p, q) = 1$, the encoding length of z is defined as $<z> := 1 + \lceil log_{2}(|p| + 1) \rceil + \lfloor log_{2}(q) \rfloor.$

1

There are 1 best solutions below

0
On

$ \log_2(n)$ is (within 1 of) the number of digits in the binary expansion of $n$.

The $1+$ terms in the expression account for the floor and ceiling operations in order to get the number of bits exactly right for the numerator and denominator.

So this is the number of bits it takes to store (encode) the numerator and denominator of a rational number written in lowest terms.