Page 1 of 1

Maths calc - a var raised to a power - help please

Posted: Thu Jul 28, 2022 3:40 pm
by canary_wharfe
I need to do a maths calculation with one variable raised to the power of another variable like x^y.
In c code it would be something along the lines of the following using the pow function

#include <stdio.h>
#include <math.h>

int main(int argc, const char * argv[])
{
/* Define temporary variables */
REALvar1, REALvar2;
resultVAR;

/* Assign the values we will use for the pow calculation */
REALvar1 = 4;
REALvar2 = 2;

/* Calculate the result of REALvar1 raised to the power of REALvar2 */
resultVAR = pow(REALvar1, REALvar2);

I'm using float REAL variables in a 16 bit uC and just wondering how it could be handled in Flowcode?
Is it as simple as using the ^ operator or do I use something like pow? An example would be appreciated.

Re: Maths calc - a var raised to a power - help please

Posted: Thu Jul 28, 2022 4:27 pm
by Steve-Matrix
Use the function "pow()" in a calculation icon.

Re: Maths calc - a var raised to a power - help please

Posted: Thu Aug 04, 2022 10:38 am
by canary_wharfe
Thanks Steve. I should have read the Matrix online help topic and I would have got the answer to all maths operations. groan!