CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

COMPILER 5.026 trigonometric function problems?

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
benoitstjean



Joined: 30 Oct 2007
Posts: 566
Location: Ottawa, Ontario, Canada

View user's profile Send private message

COMPILER 5.026 trigonometric function problems?
PostPosted: Fri Dec 29, 2017 10:29 am     Reply with quote

Compiler: 5.026
Device: PIC24EP512GP806

Is it possible that there are calculation issues with the sin() and cos() functions?

Because if you calculate just on a calculator:

cos(90) = 0
sin(90) = 1

If I do it with the compiler and do a printf on the screen, I get the following:

float x = cos(90); -> returns -0.448
float y = sin(90); -> returns 0.893

Am I missing anything here?

Thanks,

Ben


[EDIT] I found the problem. It is in RAD. I need to convert to DEG.
temtronic



Joined: 01 Jul 2010
Posts: 9243
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Fri Dec 29, 2017 10:46 am     Reply with quote

oops ! Did the same thing using the Windows calculator and of course the W7 version is DIFFERENT than the XP one....sigh
so much for standards...
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group