Jump to content
  • Advertisement
Sign in to follow this  
subharb

Function sin() in C

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

Im using this function from math.h, but it doesnt work properly, it doenst give a correct value, the varible im calculating the sin of is double, but i tried with float and long double, anyone has any idea what i have to do it?? Thank u

Share this post


Link to post
Share on other sites
Advertisement
It's returning the correct result, well, a close approximation of a correct result. Chances are you aren't passing it the correct value.

Share this post


Link to post
Share on other sites
What do you mean when you say it's not giving the correct value? Could you give an example of what you put in the function, what you expected it to return and what it actually returned?

Note, that sin (and all the goniometric functions in C) expect the input to be in radians, not degrees. To convert from degrees to radians, divide by (180 / PI).

Share this post


Link to post
Share on other sites
Yes u are right, i was giving the angle, so sin(90) said it was 0.82 or so, now i say sin(pi/2) and returns 1.0

Thank u

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.

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!