public object Compute(
                object d1,
                object d2)
            {
                var s1 = _convOne.CoerceBoxedBigInt(d1);
                var s2 = _convTwo.CoerceBoxedBigInt(d2);

                return(s1 + s2);
            }
            public bool Compare(
                object objOne,
                object objTwo)
            {
                BigInteger s1 = convOne.CoerceBoxedBigInt((object)objOne);
                BigInteger s2 = convTwo.CoerceBoxedBigInt((object)objTwo);

                return(s1.CompareTo(s2) <= 0);
            }
            public object Compute(
                object d1,
                object d2)
            {
                var s1 = _convOne.CoerceBoxedBigInt(d1);
                var s2 = _convTwo.CoerceBoxedBigInt(d2);

                if (s2.Equals(BigInteger.Zero))
                {
                    return(null);
                }

                return(s1 / s2);
            }
Пример #4
0
            public bool IsBetween(
                object value,
                object lower,
                object upper)
            {
                if (value == null || lower == null || upper == null) {
                    return false;
                }

                BigInteger valueD = _numberCoercerValue.CoerceBoxedBigInt(value);
                BigInteger lowerD = _numberCoercerLower.CoerceBoxedBigInt(lower);
                BigInteger upperD = _numberCoercerUpper.CoerceBoxedBigInt(upper);

                if (lowerD.CompareTo(upperD) > 0) {
                    var temp = upperD;
                    upperD = lowerD;
                    lowerD = temp;
                }

                if (valueD.CompareTo(lowerD) > 0) {
                    if (valueD.CompareTo(upperD) < 0) {
                        return true;
                    }

                    if (_isHighIncluded) {
                        return valueD.Equals(upperD);
                    }

                    return false;
                }

                if (_isLowIncluded && valueD.Equals(lowerD)) {
                    return true;
                }

                return false;
            }