Find nth Root of a number in C++

c++, math

Solution

There is no "power" operator in C++; `^` is the bitwise exclusive-or operator, which is only applicable to integers.

Instead, there is a function in the standard library:

#include <cmath>

value = std::pow(value, 1.0/root);

Problem

I'm trying to make a maths library and one of the functions finds a nth root of a float. My current expression is - ``` value = value ^ 1/rootValue ``` but I'm getting an error because I'm using a float. Is there another method of solving this?

Original source