How can you raise a number to a power?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sobolevfff
    Member
    • Mar 2020
    • 81

    How can you raise a number to a power?

    Hi,

    How can I raise a number to a power?
    I have not found such a formula and

    a = b ** c;

    does not work.
  • Maximus
    Senior Member
    • Nov 2018
    • 2731

    #2
    Hi there,
    there is no such formula. You can try to use the While loop for this https://docs.espocrm.com/administration/formula/#while. Something like this:
    Code:
    $i = 2;
    while(
        $i <= c,
        b = b * b;
        $i = $i + 1;
    );
    a = b;
    Note, I didn't test this formula.

    Or you can try to add your custom formula for such purposes https://docs.espocrm.com/development...on-in-formula/.
    Last edited by Maximus; 09-16-2020, 07:01 AM.

    Comment

    • tothewine
      Active Community Member
      • Jan 2018
      • 373

      #3
      if the exponent is known ahead of time I would just express the power as multiplications

      Comment

      Working...