We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The original solution is perfect. Seems to be faster if pulling the condition of the negative outside.
double pow(double x, int n) { return n < 0 ? 1/pow(x, (long)-1*n) : pow(x, (long)n); } double __pow(double x, long n) { if (n == 0) return 1; if (n == 1) return x; if (n == 2) return x * x; if(n % 2) return __pow(__pow(x, n / 2), 2); else return __pow(__pow(x, n / 2), 2) * x; }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
The original solution is perfect. Seems to be faster if pulling the condition of the negative outside.
The text was updated successfully, but these errors were encountered: