Java tan tan(final float value)

Here you can find the source of tan(final float value)

Description

tan

License

Open Source License

Declaration

public static final float tan(final float value) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    private static float[] TG_TABLE = new float[361];

    public static final float tan(final float value) {
        final int temp;
        if (value > 0) {
            if ((int) value > 360f) {
                if ((temp = ((int) value - ((int) (value / 360f)) * 360)) != 0) {
                    return TG_TABLE[temp];
                } else {
                    return TG_TABLE[360];
                }//from   w  w  w  .j a v a 2  s.com
            } else {
                return TG_TABLE[(int) (value)];
            }
        } else if ((-(int) value) > 360f) {
            if ((temp = (-((int) value - ((int) (value / 360f)) * 360))) != 0) {
                return TG_TABLE[temp];
            } else {
                return TG_TABLE[360];
            }
        } else {
            return TG_TABLE[-(int) (value)];
        }
        //return TG_TABLE[(int)(value)];
    }

    public static final double tan(final double value) {
        final int temp;
        if (value > 0) {
            if ((int) value > 360d) {
                if ((temp = ((int) value - ((int) (value / 360d)) * 360)) != 0) {
                    return (double) TG_TABLE[temp];
                } else {
                    return (double) TG_TABLE[360];
                }
            } else {
                return (double) TG_TABLE[(int) (value)];
            }
        } else if ((-(int) value) > 360d) {
            if ((temp = (-((int) value - ((int) (value / 360d)) * 360))) != 0) {
                return (double) TG_TABLE[temp];
            } else {
                return (double) TG_TABLE[360];
            }
        } else {
            return (double) TG_TABLE[-(int) (value)];
        }
        //return (double)TG_TABLE[(int)(value)];
    }
}

Related

  1. tan(double a)
  2. tan(float angle)
  3. tan(float angle)
  4. tan(float angle)
  5. tan(float f)