Is your input range arbitrary or known in a certain range?
anyway x m = exp (m log x), so if you can create functions to evaluate exp (x) and log (x) and multiply, you're probably done.
You need to figure out how you want to handle nonpositive x values.
(hint for log (x): if it is an IEEE-754 floating point , shift the value, if necessary, until you get a range of numbers between 2 k and 2 k + 1 for some value of K. This allows you to deal with range of 2: 1, which is not too difficult to approximate by polynomials, then you have only a small number of possibilities for processing the exponent and shift number.
Corresponding hint for exp (x): write x = k + b, where 0 <= b <1, and k is an integer. Then exp (x) = exp (k) * exp (b); b has a limited range, and k has a limited number of discrete possibilities.)
(hint # 2: numbers probably work better for x m = g (mf (x)), where f (x) = log 2 x and g (x) = 2 x .)
Jason S 03 Sep '09 at 21:15 2009-09-03 21:15
source share