MathUtils { public static boolean almostEqual(double a, double b, double delta) { return Math.abs(a - b) <= delta; } private  MathUtils(); static boolean almostEqual(double a, double b, double delta); static double round(double a, double precision); static double floor(double a, double precision); static double ceil(double a, double precision); static int binarySearch(double[] a, double key); static int binarySearchFloor(double[] a, double key); static int binarySearchCeil(double[] a, double key); static T limit(T value, T min, T max); static double limit(double value, double min, double max); static float limit(float value, float min, float max); static int limit(int value, int min, int max); static int randomizedSelect(List<T> a,
			int lower, int upper, int i); static double magnitude(double base, double n); static double quantile(List<Double> values, double q); static boolean isCalculatable(Number n); static boolean isCalculatable(double n); static double normalizeDegrees(double angle);  }
@Test public void testAlmostEqual() { double delta = 1e-5; assertTrue(MathUtils.almostEqual(1.0, 1.0, delta)); assertFalse(MathUtils.almostEqual(1.0, 2.0, delta)); assertTrue(MathUtils.almostEqual(1.0, 1.0 + 0.5*delta, delta)); assertFalse(MathUtils.almostEqual(1.0, 1.0 + 2.0*delta, delta)); }