예제 #1
0
        public static CodeTerm Truncate(CodeTerm[] arguments)
        {
            Debug.Assert(arguments.Length == 1);

            try
            {
                CodeValue argValue0 = (CodeValue)arguments[0];

                CodeValueInteger argInteger0 = argValue0 as CodeValueInteger;
                if (argInteger0 != null)
                {
                    return(argInteger0);
                }

                CodeValueDouble argDouble0 = argValue0 as CodeValueDouble;
                if (argDouble0 != null)
                {
                    return(new CodeValueInteger(Convert.ToInt32(Math.Truncate(argDouble0.Value))));
                }

                return(new CodeValueInteger(Convert.ToInt32(Math.Truncate(Convert.ToDouble(argValue0.Object)))));
            }
            catch (Exception ex)
            {
                return(new CodeValueException(ex));
            }
        }
예제 #2
0
        public static void Rule(Value lhs, LiteralDouble literal)
        {
            CodeValueDouble codeValueDouble = new CodeValueDouble(double.Parse(literal.Text));

            lhs.CodeTerm = codeValueDouble;
        }
예제 #3
0
        public static void Rule(Value lhs, LiteralDouble literal)
        {
            CodeValueDouble codeValueDouble = new CodeValueDouble(double.Parse(literal.Text));

            lhs.CodeTerm = codeValueDouble;
        }