[music-dsp] Line6 nonlinear function

Phil Burk philburk at softsynth.com
Sat Feb 24 12:06:10 EST 2001


Darren Reid wrote:
>   num = num*num*num*num*num*num*num*num*num*num*num*num; //don't ask :)

> Someday I need to come up with a faster way to do this than raising a value
> to the 12th power.

You only need 4 multiplies. Hopefully, an optimizing compiler would
translate the above code to something like this:

// calculate num^12
  num2 = num * num;
  num4 = num2 * num2;
  num12 = num4 * num4 * num4;

If not, you might need to code it explicitly.

-- 
Phil Burk
http://www.softsynth.com

dupswapdrop -- the music-dsp mailing list and website: subscription info,
FAQ, source code archive, list archive, book reviews, dsp links
http://shoko.calarts.edu/musicdsp/




More information about the music-dsp mailing list