Weird but true pow(x,y) function

Function calls have: a return value, a return address, and parameters. All these are stored on the stack.

In this example, we have a 2 byte return value, a 2 byte return address, and two 2 byte parameters. That's 8 bytes per function call, so an absolute max of 128 iterations before the stack wraps (assuming you use no other RAM in your program; not likely but best case).

In addition, a function call and return (a jump and another jump) require as many as 4 cycles each, plus the overhead of storing and retrieving stack variables. A compare and branch require 2 or 3 instructions in comparison. (Note the compiler may optimize some of this badness away; this blathering is not the result of actually comparing compiler output, just looking at the instruction set.)

-j