コード例 #1
0
            public override bool VisitInt64(Expression exp, Unit input)
            {
                Int64 value;

                if (Decoder.TryValueOf(exp, ExpressionType.Int64, out value) && Rational.CanRepresentExactly(value))
                {
                    result   = Rational.For(value);
                    hasValue = true;
                }

                return(hasValue);
            }
コード例 #2
0
 public override Interval For(long value)
 {
     if (Rational.CanRepresentExactly(value))
     {
         return(Interval.For(Rational.For(value)));
     }
     else if (value >= 0) // of course it will never be zero, it is just to shut up the compiler
     {
         return(Interval.For(1, Rational.PlusInfinity));
     }
     else
     {
         return(Interval.For(Rational.MinusInfinity, -1));
     }
 }