Exponential and logarithm operations

Hi everybody,
I’m writing a smart contract stateful in PyTeal in which I have to implement some operations, including the power and logarithm operation. It’s known that it isn’t possible to use loops in PyTeal, but which can be an arithmetic alternative to implement power and logarithm?

Thanks for all the tips!

Currently it is hard except in specific cases (e.g., small exponents where you can unroll the loop).

But these functions are coming to future versions of TEAL. Stay tuned!

1 Like

You should specify the range of x values you are interested in, also the allowable error %.
Then it could be decided how to proceed.

1 Like