Jump to content
  • Advertisement

Archived

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

EvilProgrammer

Problem with ^ operator and some rounding

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

Hello, I am trying to calculate a number that is: rChange = 1/(1+10^(deltaR/400)); I''m currently testing it with deltaR being equal to 0, so the equation should come out with rChange = .5 However, my program comes up with the whole thing being 0. Also, I tried to change the equation so it would accept float numbers, for example, instead of the 400 I used 400.0f and deltaR went in as a float instead of an integer. But my compiler said that ^ could only use integers. Can anyone solve this one for me? Thanks.

Share this post


Link to post
Share on other sites
Advertisement
Are you aware that in C, C++, and Java, ^ is the modulus operator, not the exponentiation operator? The latter does not exist in C or C++, and is replaced by the function pow().


"Sneftel is correct, if rather vulgar." --Flarelocke

Share this post


Link to post
Share on other sites
Oh thanks lol boy do I feel stupid now. Yeah, I was testing it with all kinds of numbers and it was coming up with weird things and I was thoroughly confused.

[edited by - EvilProgrammer on April 20, 2004 9:07:12 PM]

Share this post


Link to post
Share on other sites
heh, oops. Yeah. Man, I dunno what the heck I was thinking.


"Sneftel is correct, if rather vulgar." --Flarelocke

[edited by - sneftel on April 20, 2004 9:20:07 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!