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

voidPow(double val, Object in)
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] = Math.pow(val, inn[i]);
} else {
    for (int i = 0, s = ((Object[]) in).length; i < s; i++)
...
doublePow(double value)
square.
return (value * value);
doublepow(double value)
pow
return Math.pow(value, 2);
doublepow(double x, double y)
pow
if (x == 0.)
    return 0.;
if (x == 1.)
    return 1.;
if (y == 0.)
    return 1.;
if (y == 1.)
    return x;
...
doublepow(double x, double y)
Raise a number to a power.
if (y == 0)
    return 1;
if (y == 1)
    return x;
if (y == -1)
    return 1 / x;
if (x != x || y != y)
    return Double.NaN;
...
doublepow(double x, double y)
pow
return powTaylor(x, y);
doublepow(double x, int n)
This is a fast pow implementation
if (n == 0) {
    return 1.0;
for (int i = 1; i < n; ++i) {
    x *= x;
return x;
double[]pow(double[] array, double exp)
calls Math.pow for each element of the array
for (int i = 0; i < array.length; i++) {
    array[i] = Math.pow(array[i], exp);
return array;
double[][]pow(double[][] x, int p)
pow
for (int i = 0; i < x.length; i++) {
    for (int j = 0; j < x[0].length; j++) {
        x[i][j] = Math.pow(x[i][j], p);
return x;
double[]pow(final double[] values, final double exp)
Performs termwise Math.pow(double,double) on the elements.
final double[] ret = new double[values.length];
for (int i = values.length; i-- != 0;)
    ret[i] = Math.pow(values[i], exp);
return ret;