Java Utililty Methods Number Power

List of utility methods to do Number Power

Description

The list of methods to do Number Power are organized into topic(s).

Method

floatpow(final float a, final float b)
Computes a fast approximation to Math.pow(a, b).
return (float) Math.pow(a, b);
longpow(final int a, final int b)
Integer version of Math#pow(double,double) .
long c = 1;
for (int i = 0; i < b; ++i)
    c *= a;
return c;
intpow(final int a, final int b)
pow
if (b == 0)
    return 1;
else if (b == 1)
    return a;
else {
    int result = a;
    for (int i = 1; i < b; i++)
        result *= a;
...
intpow(final int b, final int e)
Retrieves the value of the base raised to the power of the exponent
if (e < 0) {
    throw new IllegalArgumentException("pow does not support negative exponent: " + e);
int v = 1;
for (int i = 0; i < e; i++) {
    v *= b;
return v;
...
longpow(final long base, final long exponent)
pow
if (exponent == 0) {
    return 1;
} else {
    long start = base;
    for (int i = 1; i < exponent; i++) {
        start *= base;
    return start;
...
floatpow(float a, float b)
pow
return (float) StrictMath.pow(a, b);
floatPow(float base, float exponent)
Pow
return (float) Math.pow(base, exponent);
floatpow(float x, int y)
Raises first argument to the power of the second argument.
float val = 1.0f;
for (int i = 0; i < Math.abs(y); i++) {
    val *= x;
if (y < 0) {
    return 1.0f / val;
return val;
...
float[]pow(float[] inData, float rate)
pow
float[] out = new float[inData.length];
for (int i = 0; i < inData.length; i++) {
    out[i] = (float) Math.pow(inData[i], rate);
return out;
voidpow(float[][] in)
pow
int width = in[0].length;
int height = in.length;
for (int yy = 0; yy < height; yy++) {
    for (int xx = 0; xx < width; xx++) {
        in[yy][xx] = in[yy][xx] * in[yy][xx];