Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I have problems in calculating cube roots of negative numbers. For example pow (-27.1 / 3), should give -3, but fails. Any idea why?
I am not sure about the reason. Since square root would return an imaginary number pow might have restricted the computation.
Alternatively you can try, sign(x)*pow(fabs(x),1/3).
Kiran.
I am not sure about the reason. Since square root would return an imaginary number pow might have restricted the computation.
Alternatively you can try, sign(x)*pow(fabs(x),1/3).
Kiran.
What if I would like to return an imaginary number?