Jump to content
  • Advertisement

Archived

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

Omicron

Natural log C++

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

basically I want to get this equation x = log (x) * 3 to work in C++. I have #include <math.h> in the header, but its not working right. ALso I need "ln" not "log". how can I do that?

Share this post


Link to post
Share on other sites
Advertisement
Define "not working right". Compile error? Link error? Runtime error? Bad result?

If you want the natural log, you can divide log(x) by log(e).

Share this post


Link to post
Share on other sites
ok, nvm. I got it working. For some reason I had x =1 and it was just giving me garbage like, 3jkl2. But changing x to any other number works.

Share this post


Link to post
Share on other sites
And despite you having already solved your problem, I'm bored and need to say things...

quote:
If you want the natural log, you can divide log(x) by log(e).
True, but unnecessary since log() already is natural log in the CRT.

quote:
For some reason I had x=1 and it was just giving me garbage like, 3jkl2
If e^0==1 then ln(1)==0 so if you iterate and pass x=1 then you will eventually find yourself doing ln(0) ... which you can't.

Jans.

[edited by - jansic on April 15, 2004 5:12:19 PM]

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!