in reply to Re: How can I tell if a number is a power of 2?
in thread How can I tell if a number is a power of 2?

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.


T I M T O W T D I

Edit by tye to replace PRE to CODE around long line(s)