What is wrong with this method/approach?


#1
int Solution::isPower(int A) {
    if(A==1)
        return 1;
    else
    {
        for(int y=2; y<32; y++)
        {
            int x=pow(A,1.0/y);            
            if(pow(x, y)==A)
                return 1;
        }
        return 0;    
    }
}

The program is failing for 823543.


#2

you compare integer to double pow(x, y)==A, this will hold true any time an integer part of pow(x, y) will be equal to A