Searching \ for '[PIC]: Algortithm sort - raising to a power' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: techref.massmind.org/techref/power.htm?key=power
Search entire site for: 'Algortithm sort - raising to a power'.

Exact match. Not showing close matches.
PICList Thread
'[PIC]: Algortithm sort - raising to a power'
2003\03\13@194603 by Russell McMahon

face
flavicon
face
Wanted:

           Algorithm for A = 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

2003\03\13@213940 by Scott Dattalo

face
flavicon
face
On Fri, 14 Mar 2003, Russell McMahon wrote:

> Wanted:
>
>             Algorithm for A = 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.

I have two suggestions:

1) Feynman's Power Algorithm

 - See Vol 1 of TAOCP, Chapter 1 problem 28

2) Lookup tables with interpolation

 - This will be easier to implement

The power function for powers close to one (like 0.85) is very "smooth".
I can't really quantify (other than saying that the error is somewhat
proportional to the first derivative). However if both X and B vary then
the lookup table isn't too useful.

Scott

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads

More... (looser matching)
- Last day of these posts
- In 2003 , 2004 only
- Today
- New search...