maxv() private static method

private static maxv ( double lhMax, Object args, int start ) : double
lhMax double
args Object
start int
return double
Beispiel #1
0
        public static double max(Object x, Object y, params Object[] args)
        {
            if (x is Missing)
            {
                return(Double.NegativeInfinity);
            }
            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 lhMax = dx;

            if (result < 0)
            {
                lhMax = dy;
            }
            if (args.Length == 0)
            {
                return(lhMax);
            }
            return(MathObject.maxv(lhMax, args, 0));
        }
Beispiel #2
0
        private static double maxv(double lhMax, Object[] args, int start)
        {
            if (args.Length == start)
            {
                return(lhMax);
            }
            double head   = Convert.ToNumber(args[start]);
            double result = MathObject.Compare(lhMax, head);

            if (result != result)
            {
                return(result);
            }
            if (result > 0)
            {
                head = lhMax;
            }
            return(MathObject.maxv(head, args, start + 1));
        }