Java atan atan_mag1(double x)

Here you can find the source of atan_mag1(double x)

Description

atamag

License

Open Source License

Declaration

protected static final double atan_mag1(double x) 

Method Source Code

//package com.java2s;

public class Main {
    protected static final double atan_mag1(double x) {
        // accuracy = 0.26814 degrees
        //   return x/(1+0.28087207802773*x*x);

        if (true) {
            if (Math.abs(x) > 1)
                System.out.printf("ATAN_MAG1: %15f\n", x);

            final double p0 = -0.000158023363661;
            final double p1 = 1.003839939589617;
            final double p2 = -0.016224975245612;
            final double p3 = -0.343317496147292;
            final double p4 = 0.141501628812858;

            double a = Math.abs(x);
            double a2 = a * a;

            double y = p0 + p1 * a + p2 * a2 + p3 * (a2 * a) + p4 * (a2 * a2);

            if (x < 0)
                return -y;
            return y;
        } else {//from   w  w w. jav a 2 s.co m
            double xx = x * x;

            // accuracy = 0.10550 degrees (according to matlab)
            return (0.00182789418543 + 0.97687229491851 * x + 0.00087659977713 * xx)
                    / (0.99499024627366 + 0.00228262896304 * x + 0.25288677429562 * xx);
        }
    }
}

Related

  1. atan(float x)
  2. atan(int f)
  3. atan(Integer a)
  4. atan(Number x)
  5. atan_66s(double x)
  6. atanAlternative(double y, double x)
  7. atanD(final double arg)