Mathematics

How to calculate log2 without the real function

In computer science, being able to count in binary is pretty much a prerequisite. So too is being able to quickly work out the decimal range of a binary number by just knowing itsĀ length in bits. For example, an 8-bit number has 256 levels; a 10-bit number 1024; a 16-bit number 65536.
But working back the other way – this is, finding the number of bits based on the number of levels – is a bit harder. Calculators have a… Read more