Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: Re: How can I tell if a number is a power of 2?

by Cine (Friar)
on Jan 29, 2002 at 00:25 UTC ( [id://142181]=note: print w/replies, xml ) Need Help??


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)

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://142181]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (3)
As of 2024-04-25 06:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found