/** * Greater or equal relation. * * @param a the a number (a >= b) * @param b the b number (a >= b) * * @return if a = Double.NaN or b = Double.NaN return Double.NaN, * else if a >= b return 1, * otherwise return 0. */ public static double geq(double a, double b) { if ((Double.IsNaN(a)) || (Double.IsNaN(b))) { return(Double.NaN); } double eps = NumberTheory.max(epsilon, MathFunctions.ulp(b)); if (Double.IsInfinity(a) || Double.IsInfinity(b)) { eps = 0; } double result = BooleanAlgebra.FALSE; if (epsilonComparison) { if (a >= b - eps) { result = BooleanAlgebra.TRUE; } } else if (a >= b) { result = BooleanAlgebra.TRUE; } return(result); }
/** * Greater or equal relation. * * @param a the a number (a >= b) * @param b the b number (a >= b) * * @return if a = Double.NaN or b = Double.NaN return Double.NaN, * else if a >= b return 1, * otherwise return 0. */ public static double geq(double a, double b) { if ((Double.IsNaN(a)) || (Double.IsNaN(b))) { return(Double.NaN); } double eps = NumberTheory.max(epsilon, MathFunctions.ulp(b)); double result = 0; if (epsilonComparison) { if (a >= b - eps) { result = 1; } } else if (a >= b) { result = 1; } return(result); }