Java sin sin(final double value)

Here you can find the source of sin(final double value)

Description

sin

License

Open Source License

Declaration

public static final double sin(final double value) 

Method Source Code

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

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

    public static final float sin(final float value) {
        //temp - crutch
        final int temp;
        if (value > 0) {
            if ((int) value > 360f) {
                if ((temp = ((int) value - ((int) (value / 360f)) * 360)) != 0) {
                    return SIN_TABLE[temp];
                } else {
                    return SIN_TABLE[360];
                }/*w w w . j  av  a  2s. co m*/
            } else {
                return SIN_TABLE[(int) (value)];
            }
        } else if ((-(int) value) > 360f) {
            if ((temp = (-((int) value - ((int) (value / 360f)) * 360))) != 0) {
                return SIN_TABLE[temp];
            } else {
                return SIN_TABLE[360];
            }
        } else {
            return SIN_TABLE[-(int) (value)];
        }
        //return SIN_TABLE[(int)(value)];//?
    }

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

Related

  1. sin(double a)
  2. sin(double anAngle)
  3. sin(double d)
  4. sin(double radians)
  5. sin(double... v)
  6. sin(final float angle)
  7. sin(float angle)
  8. sin(float angle)
  9. sin(float n)