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)); } }
public static void Rule(Value lhs, LiteralDouble literal) { CodeValueDouble codeValueDouble = new CodeValueDouble(double.Parse(literal.Text)); lhs.CodeTerm = codeValueDouble; }
public static void Rule(Value lhs, LiteralDouble literal) { CodeValueDouble codeValueDouble = new CodeValueDouble(double.Parse(literal.Text)); lhs.CodeTerm = codeValueDouble; }