Larry, Thanks for your help !! Your 3rd degree polynomial helped me a lot... BTW, i think to try to change the PIC17 routine Pow to use with PIC16... What do you think about it ?? Is it a good ideia ?? Thanks for your help !! []4s Jeferson Martin > - -----Mensagem original----- > De: pic microcontroller discussion list > [mailto:PICLIST@MITVMA.MIT.EDU]Em nome de Larry Bradley > Enviada em: quinta-feira, 9 de janeiro de 2003 19:33 > Para: PICLIST@MITVMA.MIT.EDU > Assunto: Re: Floating Point Math Routine (Pow) for PIC16 > > > OK, here are two 3rd degree polynomials to approximate y=x^0 190255, > where > x is P/P1 in your case. > > I have assumed that 100<= P<= 1200. P1 is always < P, thus t he lowest > value > for x will be 100/1200 = 0.0833. > > I generated a table of y=x^.190255 for 0.08<=x<=1.0. As in m y case, > it was > necessary to split the data into two ranges to get a good fi t. Thus > we get > > For 0.08<=x<=0.3: > > y=0.48093+2.12405x-5.51251x^2+6.42179x^3 > > and for 0.3<=x<=1: > > y = .612857+.763474x-.569529x^2+.193612x^3 > > Thus select a poly based on the pressure ratio P/P1 and eval uate it, > and > then evaluate the rest of the function to find the altitude. > > Larry > > > At 12:13 PM 1/9/2003 +0000, you wrote: > >Hello Larry, it4s my case. I need to calculate the follow e q: > >(p/p1) ^0.190255, p and p1 are variables. Can you explain how i can > >do it ? I need to use PIC16 due to PIC17 be very large. I h ave > >already downloaded the stadard FP routines (+,- ,...) from Microchip > >site, but i don4t know how i can use it to calculate the po w > >function. > > > >Thanks a lot! > > > >[]4s > >Jeferson Martin > > > >Larry Bradley escreveu: > > > > > There are two appnotes. One is the basic add, subtract stuff, > > > the other (AN660) is for the power, log, etc. It is a lo t of code > > > - the power function requires some of the others, as I recall. > > > > > > I needed a power function for the system I'm working on - The > > > exponent in my case is a constant (y=x^0.386), so I fit a 3rd > > > degree polynomial to the curve, and used that and the st andard FP > > > routines. If the exponent is a variable, of course, you can't do > > > that. > > > > > > Larry > > > > > > At 10:31 AM 1/9/2003 +0000, you wrote: > > > >Yeah, but not a POW floating point routine for PIC16, o nly > > > >for PIC17. I really need for PIC16 family. I had not se en > > > >any POW floating point routine on the Microchip web sit e > > > >for PIC16... > > > > > > > >Thanks.... > > > > > > > >[]4s > > > >Jeferson Martin > > > > > > > > > > > >Larry Bradley escreveu: > > > > > > > > > There are floating point routines on the Microchip w eb site. > > > > > > > > > > At 09:52 AM 1/9/2003 +0000, you wrote: > > > > > >Hello, > > > > > > > > > > > >Please, does anyone know where i can find a floatin g point > > > > > >routine in assembly for PIC16 family ? I need the P OW > > > > > >routine with a precision of 32 bits. > > > > > > > > > > > >Thanks. > > > > > > > > > > > >[]4s > > > > > >Jeferson Martin > > > > > > > > > > > >-- > > > > > >http://www.piclist.com hint: The PICList is archive d three > > > > > >different ways. See http://www.piclist.com/#archiv es for > > > > > >details. > > > > > > > > > > Larry Bradley > > > > > Orleans (Ottawa), Ontario, CANADA > > > > > > > > > > -- > > > > > http://www.piclist.com hint: The PICList is archived three > > > > > different ways. See http://www.piclist.com/#archive s for > > > > > details. > > > > > > > > > > > > > > > > > > > > >-- > > > > > > > >-- > > > >http://www.piclist.com hint: The PICList is archived th ree > > > >different ways. See http://www.piclist.com/#archives f or > > > >details. > > > > > > Larry Bradley > > > Orleans (Ottawa), Ontario, CANADA > > > > > > -- > > > http://www.piclist.com hint: The PICList is archived thr ee > > > different ways. See http://www.piclist.com/#archives fo r > > > details. > > > > > > > > > > >-- > > > >-- > >http://www.piclist.com hint: The PICList is archived three different > >ways. See http://www.piclist.com/#archives for details. > > Larry Bradley > Orleans (Ottawa), Ontario, CANADA > > - -- > http://www.piclist.com hint: The PICList is archived three d ifferent > ways. See http://www.piclist.com/#archives for details. > > -----BEGIN PGP SIGNATURE----- > Version: PGPfreeware 7.0.3 for non- commercial use > > iQA/AwUBPiLHTV1/Ek0rIOLpEQK1GgCg/AQPxuQcL1YRAZ4J0BB2SuBa1vYA oNf5 > 5IinOEnt4aIqFDp3IXrzq5B7 > =d1nL > -----END PGP SIGNATURE----- > > -- http://www.piclist.com hint: The list server can filter out subtopics (like ads or off topics) for you. See http://www.piclist.com/#topics