Beispiel #1
0
        public override Dynamic BinaryOperation(BinaryOperator _operator, Dynamic operand)
        {
            switch (_operator)
            {
            case BinaryOperator.Plus:
                return(new Decimal(value + operand.AsBigDecimal));

            case BinaryOperator.Minus:
                return(new Decimal(value - operand.AsBigDecimal));

            case BinaryOperator.Times:
                return(new Decimal(value * operand.AsBigDecimal));

            case BinaryOperator.Divide:
                return(new Decimal(value / operand.AsBigDecimal));

            case BinaryOperator.Modulo:
                return(new Decimal(value % operand.AsBigDecimal));

            case BinaryOperator.Power:
                return(new Decimal(value.Power(operand.AsInt32)));

            case BinaryOperator.LessThan:
                return(Boolean.FromBool(value < operand.AsBigDecimal));

            case BinaryOperator.LessThanOrEqual:
                return(Boolean.FromBool(value <= operand.AsBigDecimal));

            case BinaryOperator.GreaterThan:
                return(Boolean.FromBool(value > operand.AsBigDecimal));

            case BinaryOperator.GreaterThanOrEqual:
                return(Boolean.FromBool(value >= operand.AsBigDecimal));

            default:
                return(base.BinaryOperation(_operator, operand));
            }
        }
Beispiel #2
0
 public static BigDecimal /*!*/ Power(RubyContext /*!*/ context, BigDecimal /*!*/ self, int other)
 {
     return(BigDecimal.Power(GetConfig(context), self, other));
 }