Here you can find the source of cos(int angle)
public static float cos(int angle)
//package com.java2s; //License from project: Apache License public class Main { private static final float[] cos = { 1.0f, 0.9998477f, 0.99939084f, 0.9986295f, 0.9975641f, 0.9961947f, 0.9945219f, 0.99254614f, 0.99026805f, 0.98768836f, 0.9848077f, 0.98162717f, 0.9781476f, 0.97437006f, 0.9702957f, 0.9659258f, 0.9612617f, 0.9563047f, 0.95105654f, 0.94551855f, 0.9396926f, 0.9335804f, 0.92718387f, 0.92050487f, 0.9135454f, 0.9063078f, 0.89879405f, 0.8910065f, 0.88294756f, 0.8746197f, 0.8660254f, 0.8571673f, 0.8480481f, 0.83867055f, 0.82903755f, 0.81915206f, 0.809017f, 0.7986355f, 0.7880108f, 0.777146f, 0.76604444f, 0.7547096f, 0.7431448f, 0.7313537f, 0.7193398f, 0.70710677f, 0.6946584f, 0.6819984f, 0.6691306f, 0.656059f, 0.64278764f, 0.6293204f, 0.6156615f, 0.60181504f, 0.58778524f, 0.57357645f, 0.5591929f, 0.54463905f, 0.52991927f, 0.5150381f, 0.5f, 0.4848096f, 0.46947157f, 0.4539905f, 0.43837115f, 0.42261827f, 0.40673664f, 0.39073113f, 0.37460658f, 0.35836795f, 0.34202015f, 0.32556817f, 0.309017f, 0.2923717f, 0.27563736f, 0.25881904f, 0.2419219f, 0.22495106f, 0.20791169f, 0.190809f, 0.17364818f, 0.15643446f, 0.1391731f, 0.12186934f, 0.104528464f, 0.087155744f, 0.06975647f, 0.052335955f, 0.034899496f, 0.017452406f, 6.123234E-17f, -0.017452406f, -0.034899496f, -0.052335955f, -0.06975647f, -0.087155744f, -0.104528464f, -0.12186934f, -0.1391731f, -0.15643446f, -0.17364818f, -0.190809f, -0.20791169f, -0.22495106f, -0.2419219f, -0.25881904f, -0.27563736f, -0.2923717f, -0.309017f, -0.32556817f, -0.34202015f, -0.35836795f, -0.37460658f, -0.39073113f, -0.40673664f, -0.42261827f, -0.43837115f, -0.4539905f, -0.46947157f, -0.4848096f, -0.5f, -0.5150381f, -0.52991927f, -0.54463905f, -0.5591929f, -0.57357645f, -0.58778524f, -0.60181504f, -0.6156615f, -0.6293204f, -0.64278764f, -0.656059f, -0.6691306f, -0.6819984f, -0.6946584f, -0.70710677f, -0.7193398f, -0.7313537f, -0.7431448f, -0.7547096f, -0.76604444f, -0.777146f, -0.7880108f, -0.7986355f, -0.809017f, -0.81915206f, -0.82903755f, -0.83867055f, -0.8480481f, -0.8571673f, -0.8660254f, -0.8746197f, -0.88294756f, -0.8910065f, -0.89879405f, -0.9063078f, -0.9135454f, -0.92050487f, -0.92718387f, -0.9335804f, -0.9396926f, -0.94551855f, -0.95105654f, -0.9563047f, -0.9612617f, -0.9659258f, -0.9702957f, -0.97437006f, -0.9781476f, -0.98162717f, -0.9848077f, -0.98768836f, -0.99026805f, -0.99254614f, -0.9945219f, -0.9961947f, -0.9975641f, -0.9986295f, -0.99939084f, -0.9998477f, -1.0f, -0.9998477f, -0.99939084f, -0.9986295f, -0.9975641f, -0.9961947f, -0.9945219f, -0.99254614f, -0.99026805f, -0.98768836f, -0.9848077f, -0.98162717f, -0.9781476f, -0.97437006f, -0.9702957f, -0.9659258f, -0.9612617f, -0.9563047f, -0.95105654f, -0.94551855f, -0.9396926f, -0.9335804f, -0.92718387f, -0.92050487f, -0.9135454f, -0.9063078f, -0.89879405f, -0.8910065f, -0.88294756f, -0.8746197f, -0.8660254f, -0.8571673f, -0.8480481f, -0.83867055f, -0.82903755f, -0.81915206f, -0.809017f, -0.7986355f, -0.7880108f, -0.777146f, -0.76604444f, -0.7547096f, -0.7431448f, -0.7313537f, -0.7193398f, -0.70710677f, -0.6946584f, -0.6819984f, -0.6691306f, -0.656059f, -0.64278764f, -0.6293204f, -0.6156615f, -0.60181504f, -0.58778524f, -0.57357645f, -0.5591929f, -0.54463905f, -0.52991927f, -0.5150381f, -0.5f, -0.4848096f, -0.46947157f, -0.4539905f, -0.43837115f, -0.42261827f, -0.40673664f, -0.39073113f, -0.37460658f, -0.35836795f, -0.34202015f, -0.32556817f, -0.309017f, -0.2923717f, -0.27563736f, -0.25881904f, -0.2419219f, -0.22495106f, -0.20791169f, -0.190809f, -0.17364818f, -0.15643446f, -0.1391731f, -0.12186934f, -0.104528464f, -0.087155744f, -0.06975647f, -0.052335955f, -0.034899496f, -0.017452406f, -1.8369701E-16f, 0.017452406f, 0.034899496f, 0.052335955f, 0.06975647f, 0.087155744f, 0.104528464f, 0.12186934f, 0.1391731f, 0.15643446f, 0.17364818f, 0.190809f, 0.20791169f, 0.22495106f, 0.2419219f, 0.25881904f, 0.27563736f, 0.2923717f, 0.309017f, 0.32556817f, 0.34202015f, 0.35836795f, 0.37460658f, 0.39073113f, 0.40673664f, 0.42261827f, 0.43837115f, 0.4539905f, 0.46947157f, 0.4848096f, 0.5f, 0.5150381f, 0.52991927f, 0.54463905f, 0.5591929f, 0.57357645f, 0.58778524f, 0.60181504f, 0.6156615f, 0.6293204f, 0.64278764f, 0.656059f, 0.6691306f, 0.6819984f, 0.6946584f, 0.70710677f, 0.7193398f, 0.7313537f, 0.7431448f, 0.7547096f, 0.76604444f, 0.777146f, 0.7880108f, 0.7986355f, 0.809017f, 0.81915206f, 0.82903755f, 0.83867055f, 0.8480481f, 0.8571673f, 0.8660254f, 0.8746197f, 0.88294756f, 0.8910065f, 0.89879405f, 0.9063078f, 0.9135454f, 0.92050487f, 0.92718387f, 0.9335804f, 0.9396926f, 0.94551855f, 0.95105654f, 0.9563047f, 0.9612617f, 0.9659258f, 0.9702957f, 0.97437006f, 0.9781476f, 0.98162717f, 0.9848077f, 0.98768836f, 0.99026805f, 0.99254614f, 0.9945219f, 0.9961947f, 0.9975641f, 0.9986295f, 0.99939084f, 0.9998477f, 1.0f, 0.9998477f, 0.99939084f, 0.9986295f, 0.9975641f, 0.9961947f, 0.9945219f, 0.99254614f, 0.99026805f, 0.98768836f, 0.9848077f, 0.98162717f, 0.9781476f, 0.97437006f, 0.9702957f, 0.9659258f, 0.9612617f, 0.9563047f, 0.95105654f, 0.94551855f, 0.9396926f, 0.9335804f, 0.92718387f, 0.92050487f, 0.9135454f, 0.9063078f, 0.89879405f, 0.8910065f, 0.88294756f, 0.8746197f, 0.8660254f, 0.8571673f, 0.8480481f, 0.83867055f, 0.82903755f, 0.81915206f, 0.809017f, 0.7986355f, 0.7880108f, 0.777146f, 0.76604444f, 0.7547096f, 0.7431448f, 0.7313537f, 0.7193398f, 0.70710677f, 0.6946584f, 0.6819984f, 0.6691306f, 0.656059f, 0.64278764f, 0.6293204f, 0.6156615f, 0.60181504f, 0.58778524f, 0.57357645f, 0.5591929f, 0.54463905f, 0.52991927f, 0.5150381f, 0.5f, 0.4848096f, 0.46947157f, 0.4539905f, 0.43837115f, 0.42261827f, 0.40673664f, 0.39073113f, 0.37460658f, 0.35836795f, 0.34202015f, 0.32556817f, 0.309017f, 0.2923717f, 0.27563736f, 0.25881904f, 0.2419219f, 0.22495106f, 0.20791169f, 0.190809f, 0.17364818f, 0.15643446f, 0.1391731f, 0.12186934f, 0.104528464f, 0.087155744f, 0.06975647f, 0.052335955f, 0.034899496f, 0.017452406f, 6.123234E-17f, -0.017452406f, -0.034899496f, -0.052335955f, -0.06975647f, -0.087155744f, -0.104528464f, -0.12186934f, -0.1391731f, -0.15643446f, -0.17364818f, -0.190809f, -0.20791169f, -0.22495106f, -0.2419219f, -0.25881904f, -0.27563736f, -0.2923717f, -0.309017f, -0.32556817f, -0.34202015f, -0.35836795f, -0.37460658f, -0.39073113f, -0.40673664f, -0.42261827f, -0.43837115f, -0.4539905f, -0.46947157f, -0.4848096f, -0.5f, -0.5150381f, -0.52991927f, -0.54463905f, -0.5591929f, -0.57357645f, -0.58778524f, -0.60181504f, -0.6156615f, -0.6293204f, -0.64278764f, -0.656059f, -0.6691306f, -0.6819984f, -0.6946584f, -0.70710677f, -0.7193398f, -0.7313537f, -0.7431448f, -0.7547096f, -0.76604444f, -0.777146f, -0.7880108f, -0.7986355f, -0.809017f, -0.81915206f, -0.82903755f, -0.83867055f, -0.8480481f, -0.8571673f, -0.8660254f, -0.8746197f, -0.88294756f, -0.8910065f, -0.89879405f, -0.9063078f, -0.9135454f, -0.92050487f, -0.92718387f, -0.9335804f, -0.9396926f, -0.94551855f, -0.95105654f, -0.9563047f, -0.9612617f, -0.9659258f, -0.9702957f, -0.97437006f, -0.9781476f, -0.98162717f, -0.9848077f, -0.98768836f, -0.99026805f, -0.99254614f, -0.9945219f, -0.9961947f, -0.9975641f, -0.9986295f, -0.99939084f, -0.9998477f, -1.0f, -0.9998477f, -0.99939084f, -0.9986295f, -0.9975641f, -0.9961947f, -0.9945219f, -0.99254614f, -0.99026805f, -0.98768836f, -0.9848077f, -0.98162717f, -0.9781476f, -0.97437006f, -0.9702957f, -0.9659258f, -0.9612617f, -0.9563047f, -0.95105654f, -0.94551855f, -0.9396926f, -0.9335804f, -0.92718387f, -0.92050487f, -0.9135454f, -0.9063078f, -0.89879405f, -0.8910065f, -0.88294756f, -0.8746197f, -0.8660254f, -0.8571673f, -0.8480481f, -0.83867055f, -0.82903755f, -0.81915206f, -0.809017f, -0.7986355f, -0.7880108f, -0.777146f, -0.76604444f, -0.7547096f, -0.7431448f, -0.7313537f, -0.7193398f, -0.70710677f, -0.6946584f, -0.6819984f, -0.6691306f, -0.656059f, -0.64278764f, -0.6293204f, -0.6156615f, -0.60181504f, -0.58778524f, -0.57357645f, -0.5591929f, -0.54463905f, -0.52991927f, -0.5150381f, -0.5f, -0.4848096f, -0.46947157f, -0.4539905f, -0.43837115f, -0.42261827f, -0.40673664f, -0.39073113f, -0.37460658f, -0.35836795f, -0.34202015f, -0.32556817f, -0.309017f, -0.2923717f, -0.27563736f, -0.25881904f, -0.2419219f, -0.22495106f, -0.20791169f, -0.190809f, -0.17364818f, -0.15643446f, -0.1391731f, -0.12186934f, -0.104528464f, -0.087155744f, -0.06975647f, -0.052335955f, -0.034899496f, -0.017452406f, -1.8369701E-16f, 0.017452406f, 0.034899496f, 0.052335955f, 0.06975647f, 0.087155744f, 0.104528464f, 0.12186934f, 0.1391731f, 0.15643446f, 0.17364818f, 0.190809f, 0.20791169f, 0.22495106f, 0.2419219f, 0.25881904f, 0.27563736f, 0.2923717f, 0.309017f, 0.32556817f, 0.34202015f, 0.35836795f, 0.37460658f, 0.39073113f, 0.40673664f, 0.42261827f, 0.43837115f, 0.4539905f, 0.46947157f, 0.4848096f, 0.5f, 0.5150381f, 0.52991927f, 0.54463905f, 0.5591929f, 0.57357645f, 0.58778524f, 0.60181504f, 0.6156615f, 0.6293204f, 0.64278764f, 0.656059f, 0.6691306f, 0.6819984f, 0.6946584f, 0.70710677f, 0.7193398f, 0.7313537f, 0.7431448f, 0.7547096f, 0.76604444f, 0.777146f, 0.7880108f, 0.7986355f, 0.809017f, 0.81915206f, 0.82903755f, 0.83867055f, 0.8480481f, 0.8571673f, 0.8660254f, 0.8746197f, 0.88294756f, 0.8910065f, 0.89879405f, 0.9063078f, 0.9135454f, 0.92050487f, 0.92718387f, 0.9335804f, 0.9396926f, 0.94551855f, 0.95105654f, 0.9563047f, 0.9612617f, 0.9659258f, 0.9702957f, 0.97437006f, 0.9781476f, 0.98162717f, 0.9848077f, 0.98768836f, 0.99026805f, 0.99254614f, 0.9945219f, 0.9961947f, 0.9975641f, 0.9986295f, 0.99939084f, 0.9998477f };//from w w w. j a v a 2 s . c o m public static float cos(int angle) { return cos[angle]; } }