Quote:
Originally Posted by buddy.smith
I stand corrected.
Still, he does not need floating point for this.
(to the OP): Have you ever heard of "fixed point" math? Someone touched on it earlier - if you need .001 precision, then multiply everything by 1000. Keep in mind that at .001 precision, you can measure just one inch with your A/D....
ttyl,
--buddy
|
Well, floating point is the most direct solution to the precision needed for complex formula. The values he starts with and the values he'll wind up with ought to be ints, but that doesn't mean that everything in the formula can necessarily be rounded.
I mean,
current_height=29.401*(pow((0.0049*((double)Get_An alog_Value(rc_ana_in01)) - 0.0044),-1.0895));
Shouldn't be turned into
current_height=30*(pow((0*((double)Get_Analog_Valu e(rc_ana_in01)) - 0),-1));
You'd always get a divide by zero =P!
However you might be right in that floats/doubles aren't the tools for the job...I can't say; I'm not up on PIC architecture
