@Test public void testIsBetween() { Assert.assertEquals(true, SumatraMath.isBetween(-2, -10, 0)); Assert.assertEquals(true, SumatraMath.isBetween(5, -10, 10)); Assert.assertEquals(false, SumatraMath.isBetween(-20, -10, 10)); Assert.assertEquals(false, SumatraMath.isBetween(15, -10, 10)); Assert.assertEquals(true, SumatraMath.isBetween(10, -10, 10)); Assert.assertEquals(true, SumatraMath.isBetween(0, 0, 0)); Assert.assertEquals(true, SumatraMath.isBetween(0, Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY)); }
public static boolean isBetween(final double x, final double min, final double max) { boolean result; if (max > min) { result = (x >= min) && (x <= max); } else { result = (x >= max) && (x <= min); } return result; }
SumatraMath { public static boolean isBetween(final double x, final double min, final double max) { boolean result; if (max > min) { result = (x >= min) && (x <= max); } else { result = (x >= max) && (x <= min); } return result; } }
SumatraMath { public static boolean isBetween(final double x, final double min, final double max) { boolean result; if (max > min) { result = (x >= min) && (x <= max); } else { result = (x >= max) && (x <= min); } return result; } private  SumatraMath(); }
SumatraMath { public static boolean isBetween(final double x, final double min, final double max) { boolean result; if (max > min) { result = (x >= min) && (x <= max); } else { result = (x >= max) && (x <= min); } return result; } private  SumatraMath(); static double sqrt(final double number); static double square(final double x); static double min(final double... values); static double max(final double... values); static boolean hasDigitsAfterDecimalPoint(final double number); static boolean isEqual(final double a, final double b, final double tolerance); static boolean isEqual(final double a, final double b); static boolean isBetween(final double x, final double min, final double max); static boolean isZero(final double v); static double relative(final double value, final double from, final double to); static double cap(final double value, final double min, final double max); static List<Double> quadraticFunctionRoots(final double a, final double b, final double c); static List<Double> cubicFunctionRoots(final double a3, final double b2, final double c1, final double d0); static double getEqualTol(); static double acos(double x); static double asin(double x); static double atan2(double y, double x); static double cos(double angle); static double sin(double angle); static double tan(double angle); static List<Double> evenDistribution1D(double min, double max, int n); }
SumatraMath { public static boolean isBetween(final double x, final double min, final double max) { boolean result; if (max > min) { result = (x >= min) && (x <= max); } else { result = (x >= max) && (x <= min); } return result; } private  SumatraMath(); static double sqrt(final double number); static double square(final double x); static double min(final double... values); static double max(final double... values); static boolean hasDigitsAfterDecimalPoint(final double number); static boolean isEqual(final double a, final double b, final double tolerance); static boolean isEqual(final double a, final double b); static boolean isBetween(final double x, final double min, final double max); static boolean isZero(final double v); static double relative(final double value, final double from, final double to); static double cap(final double value, final double min, final double max); static List<Double> quadraticFunctionRoots(final double a, final double b, final double c); static List<Double> cubicFunctionRoots(final double a3, final double b2, final double c1, final double d0); static double getEqualTol(); static double acos(double x); static double asin(double x); static double atan2(double y, double x); static double cos(double angle); static double sin(double angle); static double tan(double angle); static List<Double> evenDistribution1D(double min, double max, int n);  }