Esempio n. 1
0
        private static Value Modulo <T>(FlowController flow, IntegerDivisorModulo <T> operation,
                                        T dividend, double divisor)
        {
            int convertedValue;

            // Here we distinguish whether the integer divisor is known or not
            if (TypeConversion.TryConvertToInteger(divisor, out convertedValue))
            {
                return(operation(flow, dividend, convertedValue));
            }
            else
            {
                return(WarnPossibleModuloByZero(flow));
            }
        }
Esempio n. 2
0
        private static Value Modulo <T>(FlowController flow, IntegerDivisorModulo <T> operation,
                                        T dividend, string divisor)
        {
            int    integerValue;
            double floatValue;
            bool   isInteger;

            TypeConversion.TryConvertToNumber(divisor, false, out integerValue,
                                              out floatValue, out isInteger);

            // Here we distinguish whether the integer divisor is known or not
            if (isInteger)
            {
                return(operation(flow, dividend, integerValue));
            }
            else
            {
                return(WarnPossibleModuloByZero(flow));
            }
        }