I recently discovered that, in MATLAB 2013b at least, it is significantly faster to do repeated multiplication rather than integer powers.  That is, tic;test4p = a.^4;tocis much slower thantic;test4m = a.*a.*a.*a;tocSee http://www.walkingrandomly.com/?p=5377 for full details.  Is there any numerical reason (accuracy etc) why repeated multiplication might be a bad idea?
Is there any numerical reason for not using repeated multiplication instead of integer powers?
matlab;numerics
I'm surprised that MATLAB does not do exponentiation-by-squaring for positive integer powers, since that algorithm should require fewer multiplications. I think a consequence of that should be that numerical errors accumulate less quickly.Optimal addition-chain multiplication of exponents is an NP-complete problem, so it's not worth it to figure out the sequence of multiplies and exponentiations that minimizes the total number of multiplicative operations.