Here you can find the source of powDecay(double x, double y)
private static final double powDecay(double x, double y)
//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; } }