Java Number Power powDecay(double x, double y)

Here you can find the source of powDecay(double x, double y)

Description

pow Decay

License

Open Source License

Declaration

private static final double powDecay(double x, double y) 

Method Source Code

//package com.java2s;

public class Main {
    private static final double powDecay(double x, double y) {
        int num, den = 1001, s = 0;
        double n = x, z = Double.MAX_VALUE;

        for (int i = 1; i < s; i++)
            n *= x;//from   ww w .  j  a  v a  2 s.c  om

        while (z >= Double.MAX_VALUE) {
            den -= 1;
            num = (int) (y * den);
            s = (num / den) + 1;

            z = x;
            for (int i = 1; i < num; i++)
                z *= x;
        }

        while (n > 0) {
            double a = n;

            for (int i = 1; i < den; i++)
                a *= n;

            if ((a - z) < .00001 || (z - a) > .00001)
                return n;

            n *= .9999;
        }

        return -1.0;
    }
}

Related

  1. Pow2(Object in, double val)
  2. pow2ByteIndex(final int x)
  3. pow3_strict(final float a)
  4. pow4(double val)
  5. pow9(final double x)
  6. power(double d, int exp)
  7. power(final long x, final long n, final long p)
  8. power(int base, int power)
  9. power(int i)