Sign in to follow this  

cos(90) = -0.45?

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

As any calculator will tell you, cos(90) = 0. But for some reason, in a program I've written, it's returning -0.45! o_O Doesn't seem to matter if I use cos(), (float)cos(), cosf() etc. I tried putting it right at the beginning of the program (in case it was some weird memory corruption bug) and the same thing happens. I'm doing this on WinXP SP2, with MinGW on an AMD Sempron 2800+.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
remember those functions take radians not degrees, type "cos 90 radians" into google and you'll get your answer, so convert the 90 to radians and bobs'ya uncle

Share this post


Link to post
Share on other sites
this is because your cos function returns the answer in radians, not degrees, if you need the degrees, then you need to do this:

y = (cos(90) * (pi/180))

this will give you the result in degrees

Share this post


Link to post
Share on other sites
Quote:
Original post by rgirard413
this is because your cos function returns the answer in radians, not degrees, if you need the degrees, then you need to do this:

y = (cos(90) * (pi/180))

this will give you the result in degrees

it must be other way around.
y = cos(90*(pi/180))

Share this post


Link to post
Share on other sites

This topic is 4378 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this