This is much simpler than it looks.

How many bits are needed to encode n discrete pieces of information?

For example: the minimum number of bits needed to encode 3 numbers say x, y, and z would be ceil(lg(3)) = 2. E.g. let x = 00, y = 01, z = 11

Another example: the number of bits needed to encode all numbers between 100 and 1123 is ceil(lg(1123 - 100 + 1)) = lg(1024) = 10, so we need 10 bits.

To explain the formula:

The first part is the number of bits needed to encode possible numbers for the exponents.

The second part is the number of bits needed to encode all numbers expressed by p digits in base

The last + 1 is for the sign as mentioned.