On Fri, Jan 28, 2011 at 02:02:36PM +0100, Philipp Überbacher wrote:
Libm has log(), log10, and log2().
> The next obvious question is: Does the inaccuracy reliably result in
If the input is a power of two, and you expect an integer as
a result, just do
k = (int)(log2(x) + 1e-6)
k = (int)(log(x)/log(2) + 1e-6)
int m, k;
for (k = 0, m = 1; m < x; k++, m <<= 1);
which will round up if x is not a power of 2.
There are three of them, and Alleline.
Linux-audio-user mailing list