public static double min(Object x, Object y, params Object[] args) { if (x is Missing) { return(Double.PositiveInfinity); } double dx = Convert.ToNumber(x); if (y is Missing) { return(dx); } double dy = Convert.ToNumber(y); double result = MathObject.Compare(dx, dy); if (result != result) { return(result); } double lhMin = dx; if (result > 0) { lhMin = dy; } if (args.Length == 0) { return(lhMin); } return(MathObject.minv(lhMin, args, 0)); }
private static double minv(double lhMin, Object[] args, int start) { if (args.Length == start) { return(lhMin); } double head = Convert.ToNumber(args[start]); double result = MathObject.Compare(lhMin, head); if (result != result) { return(result); } if (result < 0) { head = lhMin; } return(MathObject.minv(head, args, start + 1)); }