a^n = a^(n/2) * a(n/2)...二分
class Solution { public: double epow(double x,int n){ if(n == 0) return 1; double tmp = epow(x , n / 2); if(n % 2 == 1) return tmp * tmp * x; else return tmp * tmp; } double pow(double x, int n) { if(abs(x - 0) < 1e-10) return 0; if(n < 0) return 1/epow(x,-n);else return epow(x,n); } };