List of utility methods to do Number Power
int | pow2(int c) pow assert c > 0;
c--;
c |= c >> 1;
c |= c >> 2;
c |= c >> 4;
c |= c >> 8;
c |= c >> 16;
c++;
...
|
int | pow2(int i) 2^i if (i < 0) return 0; int result = 1; for (int k = 0; k < i; k++) result *= 2; return result; |
long | pow2(long x) Calculates 2 in power of integer value x
long result = 1; for (long i = 1; i <= x; i++) { result *= 2; return result; |
void | Pow2(Object in, double val) Pow if (in == null) return; if (in instanceof double[]) { double[] inn = (double[]) in; for (int i = 0, s = inn.length; i < s; i++) inn[i] = (Sign(inn[i]) * Math.pow(inn[i], val)); } else { for (int i = 0, s = ((Object[]) in).length; i < s; i++) ... |
byte | pow2ByteIndex(final int x) pow Byte Index if (x < 0 || x > 7) throw new IllegalArgumentException( "Unsupported Value [" + x + "]. Only supported for values between 0 and 30 inclusive"); return BYTEPOW2[x]; |
float | pow3_strict(final float a) Strict version. return a * a * a;
|
double | pow4(double val) Convenience function to compute the fourth power of a value return val * val * val * val; |
double | pow9(final double x) pow return x * x * x * x * x * x * x * x * x;
|
double | powDecay(double x, double y) pow Decay int num, den = 1001, s = 0; double n = x, z = Double.MAX_VALUE; for (int i = 1; i < s; i++) n *= x; while (z >= Double.MAX_VALUE) { den -= 1; num = (int) (y * den); s = (num / den) + 1; ... |
double | power(double d, int exp) power double r = 1; for (int x = 0; x < exp; x++) { r *= d; return r; |