Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


Cube Root?

This topic is 5936 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

Is this something that is included in the standard off the shelf MSVC++ math.h file? If so, what's the function called? Most of the ones I don't recognize are so cryptic they might as well be in arabic or something. If not, how would I actually accomplish this? It couldn't be pretty. Reason I ask is because I'm starting to get into height mapping, and I'm working on getting to where I can make one texture cover the entire area and not be too distorted. I suppose the pow function could take care of it, using 0.33 as the power. Anyone know how reliable would this approach be? [edited by - Jederas on September 12, 2002 6:30:40 AM]

Share this post

Link to post
Share on other sites

#include <math.h>

double cube_root(double x){
return exp(1.0/3 * log(x));
// -OR-

return pow(x,1.0/3);

Both versions should be perfectly reliable.

Share this post

Link to post
Share on other sites

  • 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!