I may be missing something but the Appendix (A&B) of Microchip AN660 claims to have floating point code for both the 17C and the 16C both with the POW24 and POW32 routines. I can't comment on how good either of these routines are but after much research they are the only ones I have found. I plan on attempting to convert the 17C code for use on the 18F452 soon. I hope I'm not biting of more than I can chew. (New to the list) Mike Jones ----- Original Message ----- From: To: Sent: Thursday, January 09, 2003 7:01 AM Subject: Re: Floating Point Math Routine (Pow) for PIC16 > Scott: > > p1 and p ranges: 100.000 hPa to 1200.000 hPa > > ok ?? > > Tanks!! > > []4s > Jeferson Martin > > Scott Dattalo escreveu: > > > On Thu, 9 Jan 2003 jmartin@COMP.UFSCAR.BR wrote: > > > > > Scott, i4m trying to do an altimeter based on pressure altitude. > > > > > > So, the eq is: > > > > > > H = 44330,769[1 - (P/P1)^0,190255] > > > Where H is the altitude, P is the air pressure at altitude H at > > > a given and variable sea level pressure P1. > > > > That doesn't answer the question. Again, what are dynamic ranges of P and > > P1? Do these come from an 8-bit A/D converter or what? You originally > > asked for 32-bit precision, but I doubt you need it. > > > > It'd probably make sense in a PIC to re-write this equation like: > > > > H = A * ( 1 + P^B * (1/P1)^B) > > > > Use a lookup table to compute f(x) = x^B and then perform the simple > > arithmetic computation that follows. Of course, you'll need to scale the > > 1/P1 in a range suitable for the table. But I can't tell what the scale > > factors should be without first knowing the dynamic range of your > > variables. > > > > Scott > > > > -- > > http://www.piclist.com hint: The PICList is archived three different > > ways. See http://www.piclist.com/#archives for details. > > > > > > -- > > -- > http://www.piclist.com hint: The PICList is archived three different > ways. See http://www.piclist.com/#archives for details. > -- http://www.piclist.com hint: The PICList is archived three different ways. See http://www.piclist.com/#archives for details.