View Single Post
  #4   Spotlight this post!  
Unread 27-11-2006, 21:46
TubaMorg TubaMorg is offline
Programmermechanicalelect ricalcoach
AKA: Dan
FRC #1480 (Robatos Locos)
Team Role: Mentor
 
Join Date: Jan 2006
Rookie Year: 2005
Location: Houston
Posts: 450
TubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond repute
Re: Trig. Functions in EasyC

I would like to suggest, without actually knowing your specific application, that you might want to utilize a lookup table. If it is a situation where you need to do the calculations many, many times, then a lookup table will save you computation time as trig functions do have some overhead. Precalculate your trig function for, say, 0-359 degrees and plug the values into an array (indexed 0-359 of course!). Then when needed you just index the array for the answer. If this is a navigation application 0-359 degrees should really be enough resolution, given the error inherent in the sensors. The only drawback is, of course, you have to use up memory to store the array of floats.
Reply With Quote