Mathematical power

Hi. I need to do a math calculation with pow function. How do I do that? Thanks.
I have found this code that helps a bit. But I need to do a calculation with floats and the code does not work.

int pow(int base, int exp)
      if(exp < 0)
        return -1;

        int result = 1;
        while (exp)
            if (exp & 1)
                result *= base;
            exp >>= 1;
            base *= base;

        return result;


Could you elaborate a little more on what you’re doing? Which board? Depending on the board, the built in pow function should handle floating point.


The board is RSL-SENSE-GEVK.
I don’t find any included pow function, as when I try to do that it says “undefined reference to “pow””.
I have changed values to double and gives the same error. If I put integers then everything works.

It seems like the pow implementation that comes with the RSL10 SDK doesn’t support floating point. Your best would be to find some code online that does pow with floats and integrate that into your project.