Thread: Basic Math Help
View Single Post
  #3   Spotlight this post!  
Unread 14-02-2007, 10:27
Jake M Jake M is offline
void* Jake;
FRC #1178 (DURT)
Team Role: Programmer
 
Join Date: Jan 2006
Rookie Year: 2005
Location: Missouri
Posts: 118
Jake M has a spectacular aura aboutJake M has a spectacular aura about
Re: Basic Math Help

My first thought would be to try something like this.

Code:
current_height = Get_Analog_Value(rc_ana_in01);
current_height *= .0049;
current_height -= .0044;
current_height = pow(current_height, -1.0895);
current_height *= 29.401;
Working with floats can be very confusing, since the default casting is (int). I always like to try it like this, until I'm sure my logic is correct. In fact, this may even result in less assembly instructions, although I'm not sure at all.
__________________
Code:
void function(void)
 {
  function();
 }