Log in base 2 in c++

Discussion on C, C++ and C++11 at the COJ. This is the place to clear your doubts about these languages, and to share with the community the new things you learn about them.
Post Reply
Posts: 11
Joined: 9 years ago
Gender: Male

Log in base 2 in c++

Post by Spartan » 7 years ago

How can i calculate the log in base 2 of a number in C++?

User avatar
Posts: 1968
Joined: 9 years ago
Location: Universidad de las Ciencias Informáticas
Gender: None specified

Re: Log in base 2 in c++

Post by ymondelo20 » 7 years ago

With the function log2(num) ... from the math library.
"Every problem has a simple, fast and wrong solution" OJ's Main Law. ;)

Post Reply

Return to “C/C++/C++11”