floorlog2k
floorlog2k refers to the floor of the binary logarithm of k, written as ⌊log2(k)⌋. It is the greatest integer n such that 2^n ≤ k. This definition applies to positive k; for real numbers k > 0 it is the integer part of log base 2 of k, and for integer k ≥ 1 it identifies the position of the most significant bit in the binary representation.
For positive integers, floorlog2k also provides a convenient characterization: if k lies in the interval [2^n,
Examples help illustrate the idea: floorlog2(1) = 0, floorlog2(2) = 1, floorlog2(3) = 1, and floorlog2(4) = 2. Powers of
In computational contexts, floorlog2k is often used to determine the size class of a value, perform bit-length
Related concepts include ceil(log2(k)) and log2(k) itself, as well as bit-length, most significant bit, and various