if n is a power of two, then n = 2^x => lg n = x*lg 2 => lg n/lg 2 = x => lg n = x thus lg n is the power of 2 of your number. But usually only log10 and + natural log is avail, but lg x = log x/ lg e.
Edit by tye to replace PRE to CODE around long line(s)
In reply to Re: Re: How can I tell if a number is a power of 2?
by Cine
in thread How can I tell if a number is a power of 2?
by larryk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |