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

Use this section to discuss your embedded Flowcode projects.
Post Reply
canary_wharfe
Posts: 78
http://meble-kuchenne.info.pl
Joined: Thu Dec 10, 2020 3:54 pm
Has thanked: 6 times
Been thanked: 11 times

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

Post 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.

Steve-Matrix
Matrix Staff
Posts: 1234
Joined: Sat Dec 05, 2020 10:32 am
Has thanked: 167 times
Been thanked: 277 times

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

Post by Steve-Matrix »

Use the function "pow()" in a calculation icon.

canary_wharfe
Posts: 78
Joined: Thu Dec 10, 2020 3:54 pm
Has thanked: 6 times
Been thanked: 11 times

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

Post 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!

Post Reply