MathUtil { static public float cos(float radians) { return Sin.table[(int) ((radians + PI / 2) * radToIndex) & SIN_MASK]; }  static float sin(float radians); static float cos(float radians); static float roundFloat(float value); static float sinDeg(float degrees); static float cosDeg(float degrees); static float atan2(float y, float x); static int random(int range); static int floatToRawIntBits(float value); static int floatToIntBits(float value); static int random(int start, int end); static long random(long range); static long random(long start, long end); static Vector3 random(Vector3 start, Vector3 end); static boolean randomBoolean(); static boolean randomBoolean(float chance); static boolean randomBoolean(int probability, int bound); static boolean randomBoolean(int probability); static T random(Collection<T> collection); static List<T> randomList(Collection<T> collection, int num); static void randomIndex(List<T> list); static T randomRemove(Collection<T> collection); static float random(); static float random(float range); static float random(float start, float end); static int randomSign(); static float randomTriangular(); static float randomTriangular(float max); static float randomTriangular(float min, float max); static float randomTriangular(float min, float max, float mode); static int nextPowerOfTwo(int value); static boolean isPowerOfTwo(int value); static short clamp(short value, short min, short max); static int clamp(int value, int min, int max); static long clamp(long value, long min, long max); static float clamp(float value, float min, float max); static double clamp(double value, double min, double max); static float lerp(float fromValue, float toValue, float progress); static float lerpAngle(float fromRadians, float toRadians, float progress); static float lerpAngleDeg(float fromDegrees, float toDegrees, float progress); static int floor(float value); static int floorPositive(float value); static int ceil(float value); static int ceilPositive(float value); static int round(float value); static int roundPositive(float value); static boolean isZero(float value); static boolean isZero(float value, float tolerance); static boolean isEqual(float a, float b); static boolean isEqual(float a, float b, float tolerance); static float log(float a, float value); static float log2(float value); static final float nanoToSec; static final float FLOAT_ROUNDING_ERROR; static final int FLOAT_ROUND; static final float PI; static final float PI2; static final float E; static final float radiansToDegrees; static final float radDeg; static final float degreesToRadians; static final float degRad; static public Random random; }
@Test public void testCos() { Assert.assertEquals(1, MathUtil.cos(0), 0); Assert.assertEquals(0.5, MathUtil.cos(PI / 3), 0.01); Assert.assertEquals(0, MathUtil.cos(HALF_PI), 0.01); Assert.assertEquals(1, MathUtil.cos(PI * 2), 0.01); }