Here you can find the source of cos(final double value)
public static final double cos(final double value)
//package com.java2s; //License from project: Open Source License public class Main { private static float[] COS_TABLE = new float[361]; public static final float cos(final float value) { final int temp; if (value > 0) { if ((int) value > 360f) { if ((temp = ((int) value - ((int) (value / 360f)) * 360)) != 0) { return COS_TABLE[temp]; } else { return COS_TABLE[360]; }//from ww w . j a v a 2 s . c o m } else { return COS_TABLE[(int) (value)]; } } else if ((-(int) value) > 360f) { if ((temp = (-((int) value - ((int) (value / 360f)) * 360))) != 0) { return COS_TABLE[temp]; } else { return COS_TABLE[360]; } } else { return COS_TABLE[-(int) (value)]; } //return COS_TABLE[(int)(value)]; } public static final double cos(final double value) { final int temp; if (value > 0) { if ((int) value > 360d) { if ((temp = ((int) value - ((int) (value / 360d)) * 360)) != 0) { return (double) COS_TABLE[temp]; } else { return (double) COS_TABLE[360]; } } else { return (double) COS_TABLE[(int) (value)]; } } else if ((-(int) value) > 360d) { if ((temp = (-((int) value - ((int) (value / 360d)) * 360))) != 0) { return (double) COS_TABLE[temp]; } else { return (double) COS_TABLE[360]; } } else { return (double) COS_TABLE[-(int) (value)]; } //return (double)COS_TABLE[(int)(value)]; } }