Unless it's hidden in plain sight, a mathematical operator for exponents is not included in TB. Logarithms 'yes', but exponents apparently 'no'. School math tells me that one is the inverse of the other, and maybe I could get an exponent using the

`log()` operator. Or do something with

`runCommand()`. But I don't know how. So, until TB includes an exponent operator, I thought I'd try to "roll my own" using a macro. Actually it's two macros, the first of which calls the other automatically:

Macro 'Name': 'mExponent'

Macro 'Value':

**Code:**$MyResult=0;$MyCtr=1;
$Base=$1;$MyTempNum=$1;$Exponent=$2;
action(do("mExp_loop"))

Macro 'Name': 'mExp_loop'

Macro 'Value":

**Code:**if($MyCtr<$Exponent {
$MyTempNum=$MyTempNum*$Base;$MyCtr=$MyCtr+1; action(do("mExp_loop"))
}
else {$MyResult=$MyTempNum}

(

`$MyResult`,

`$MyCtr`,

`$Base`,

`$MyTempNum`, and

`$Exponent` need to be created as number attributes.)

Now, whenever I need an exponent, say

`$MyNum1` raised to the power

`$MyNum2`, all I need to do is enter the following as a rule or run it from a stamp:

**Code:**action(do("mExponent",$MyNum1,$MyNum2))

The result will appear in $MyResult of the note that contains the

`action()` code or that has been stamped with it.

"Plain English" explanation:

'mExponent' initializes values for a loop and substitutes in the value of the base for $1 and the exponent for $2, then runs 'mExp_loop'.

'mExp_loop' runs itself, each time multiplying the previous

`$MyTempNum` by

`$Base` and incrementing the loop counter by 1. When it's run itself enough times (as defined by the exponent) the 'if' is no longer satisfied, so it stops running itself and instead sets the final value for

`$MyResult`.

This works for positive integer exponents, enough for many present value and future value type calculations.

If there's already a more "native" TB way to do this, I would be interested to know. And maybe there's something easy via

`runCommand()`? At some point it might be nice to have a "real" exponent function that can handle non-integers and negative exponents (assuming there isn't one already).

But meantime this does the job, and shows a bit of the power of macros and a simple loop.