Documentation

Init.Data.Nat.Log2

@[extern lean_nat_log2]
def Nat.log2 (n : Nat) :

Computes ⌊max 0 (log₂ n)⌋.

log2 0 = log2 1 = 0, log2 2 = 1, ..., log2 (2^i) = i, etc.

Equations