List of utility methods to do Number Power
int | pow(int a, int b) pow if (b > 1) return a * pow(a, b - 1); else return a; |
int | pow(int a, int b, int modulus) Calculates a^b mod modulus int p = 1; for (int i = 0; i < b; i++) { p = (p * a) % modulus; return p; |
int | pow(int b, int e) compute b to the e power (b ** e) int a = 1; for (int i = 0; i < e; i++) { a *= b; return a; |
int | pow(int base, int exp) Computes an exponent. if (exp < 0) { throw new ArithmeticException("exponent must be non-negative"); if (exp == 0) { return 1; if (exp == 1) { return base; ... |
int | pow(int base, int exp) pow return exp == 0 ? 1 : pow(base, exp - 1) * base;
|
int | pow(int base, int exponent) Returns the value of the first argument raised to the power of the second argument. boolean reciprocal = false; if (exponent < 0) { reciprocal = true; int result = 1; while (exponent-- > 0) { result *= base; return reciprocal ? 1 / result : result; |
int | pow(int base, int power) pow int i, res = 1; for (i = 0; i < power; i++) { res *= base; return res; |
int | pow(int i, int pow) pow if (pow == 0 || i == 0) return 1; int r = i; if (pow > 0) { for (int j = 0; j < pow; j++) { r *= i; } else { ... |
int | pow(int leftOp, int rightOp) pow return (int) Math.pow(leftOp, rightOp); |
int | pow(int n, int p) pow if (p < 0) { throw new ArithmeticException("p cannot be negative. Invalid p: " + p); if (p == 0) return 1; if (n == 0) return 0; if (n == 1) ... |