ON a slightly aside issue (but related) there was some articles on a model = rocketry site (Rocketry Online) about building an altimeter which needed = to derive an altiude from a pressure reading. The processor used was a = chip called TICKIT (a PIC which used a interpreter and EEPROM for it's = program - viz Basic STAMP) Anyway (back to the point) the relationship between pressure and altitude = is a exponential function and the developer got around it this way.. 1. He plotted out the curve of the relationship (he plotted the integer = points he would obtain out of his ADC) 2. he fitted a series of straight line approximations with an error of = less than some % (equated to 1.5 LSB on the ADC from Memory) 3. he ended up with a series of points, with offsets and gradients (ie for = numbers greater than 20 , offset is 40 gradient is 1 so if he got 22 the = calc was "40 + (22-20) * 1 =3D 42.... he'd have points at each place where = the deviation exceeded his allowable error, and the gradient had to change 4. the processor was programmed with those arrays of values (base inputs, = base outputs, offsets) in a table/array 5. The program (in the processor) would take the input value, then but = simple math find the first base input value which was lower than (or equal = to) the input measured. it would then calculate the difference between the = input base, and the measured input. it would then multiply the offset = (gradient) by the difference, and add the result to the output offset (for = example see point 3 above) You may be able to work something similar for your application since you = appear to also working with one input variable, and one output related by = a nonlinear relationship. Hope this helps, Des bromilow Brisbane Oz >>> lhbradley@IGS.NET 14/03/03 11:20:31 am >>> You "PICed" a nasty function, Russell. I needed that for a PIC - there was a set of extended floating point routines for the PIC on the Mchip site, but they were rather large and I had some problems getting them to assemble even. But I was lucky - in my case, x was a constant 0.213, so I fit a 3rd = degree polynomial and used the standard FP package. But for the case of x being a variable, that won't work. Take a look at AN660 - it has the Mchip floating point functions. It might give you some ideas on how to proceed. Larry At 01:41 PM 3/14/2003 +1300, you wrote: >Wanted: > > Algorithm for A =3D B ^ X 0 < X < 1 > >I have a sensor output that I wish to raise to a fractional power (about >0.85 in this case but this will vary). > >While there are probably any number of algorithms or methods available to = do >this, somebody may have a favourite that is especially effective in some >manner. Neither speed or memory capacity are critical - it would just be >nice to find some "easy" way to do this well. This will be implemented on = a >non-PIC processor (but PIC seemed the best tag). Precision of any = algorithm >should be algorithm independent but I will need at least 8 bit and = possibly >up to about 12. Implementation will be in machine language. Standard = fixed >point, 4 function arithmetic routines are already available. Anything = more >complex (eg log) would need to be added. > > > > > Russell McMahon > >-- >http://www.piclist.com hint: PICList Posts must start with ONE topic: >[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads Larry Bradley Orleans (Ottawa), Ontario, CANADA -- http://www.piclist.com hint: PICList Posts must start with ONE topic: [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads -- http://www.piclist.com hint: PICList Posts must start with ONE topic: [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads