This forum is a read-only archive. Posting, replying and signing in are disabled.

Exponential and logarithm operations

cotunho

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!

fabrice

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!

Maugli

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