March 11th, 2003, 11:45 PM

radicals?
If I wanted to calculated the radical of 5/4 how would i do that in C++? Not sure of the syntax and I don't believe math.h has a radical function. Thanks.
andy
hmmm...
March 11th, 2003, 11:53 PM

nevermind..im an idiot..its in math.h
hmmm...
March 12th, 2003, 12:00 AM

I'm not sure what you are asking here. By "calculat[ing] the radical", I assume that you want to find any real root of any floatingpoint value.
The pow(double x, double y) function in math.h should do it, along with its long double cousin, powl(). They both calculate the value of x raised to the y power.
Pardon the explanation, but I don't know how far you had gotten in math. To take the nth root of a number, x, you raise x to the 1/n power. Eg, the square root of x would be pow(x,0.5) and the 10th root of x would be pow(x,0.1).
Otherwise, you could use the log() and exp() functions:
x_to_the_n = exp(log(x)/n);
If I assumed wrong about your question, please let us know.