Is this a correct form of tail recursion?

I run the following code for Pow(x, n) but still suffer from stack overflow. Is this code a correct form of tail recursion?

class Solution {
public:
    double myPow(double x, int n) {
        return calculatePow(x, n, 1);
    }
    
    double calculatePow(double x, int n, double accum) {
        if (n < 0) {
            return calculatePow(x, n+1, (1/x)*accum);
        } else if (n > 0) {
            return calculatePow(x, n-1, x*accum);
        } else {
            return accum;
        }
    }
};
Comments (5)