Java Number Power powSqrt(double x, double y)

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

Description

pow Sqrt

License

Open Source License

Declaration

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

Method Source Code

//package com.java2s;

public class Main {
    private static final double powSqrt(double x, double y) {
        int den = 1024, num = (int) (y * den), iterations = 10;
        double n = Double.MAX_VALUE;

        while (n >= Double.MAX_VALUE && iterations > 1) {
            n = x;//from  w ww.j a v a  2 s.c o  m

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

            if (n >= Double.MAX_VALUE) {
                iterations--;
                den = (int) (den / 2);
                num = (int) (y * den);
            }
        }

        for (int i = 0; i < iterations; i++)
            n = Math.sqrt(n);

        return n;
    }
}

Related

  1. powExact(long x, int y)
  2. powf(float v1, float v2)
  3. powi(double x, int p)
  4. powInt(int base, int exponent)
  5. powLLL(double[] a, double b)