Java Solution using Log


#1

Comment body goes hpublic class Solution {
public int isPower(int A) {

    if (A == 1)
    return 1;

for (int i = 2; i * i <= A; i++) {
    double val = Math.log(A) / Math.log(i);
    if ((val - (int)val) < 0.00000001)
        return 1;
}

return 0;

}

}ere.


#2

why <0.00000001 and not ==0.0 ?