Jump to content
  • Advertisement
Sign in to follow this  
corrington_j

log2 function for c++

This topic is 4890 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

online i read that math.h should have a log2 function, but when i try to compile using the log2 function and visual c++ .net, it says its undefined. Anyone know where i can find this function. Thanks.

Share this post


Link to post
Share on other sites
Advertisement
Do you need an integer or floating point version of it and does it have to be fast?
If a working floating point version is all you need then it can easily be emulated through a normal logarithm.
log(value) / log(2)

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
It looks like log2 is a C99 function. Unfortunately, MSVC++ does not support this standard.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!