System.Numerics.BigIntegerBuilder.Sub C# (CSharp) Метод

Sub() публичный Метод

public Sub ( int &sign, uint u ) : void
sign int
u uint
Результат void
        public void Sub(ref int sign, uint u) {
            if (this._iuLast == 0) {
                if (u <= this._uSmall) {
                    this._uSmall -= u;
                }
                else {
                    this._uSmall = u - this._uSmall;
                    sign = -sign;
                }
            }
            else if (u != 0) {
                this.EnsureWritable();
                uint num = this._rgu[0];
                this._rgu[0] = num - u;
                if (num < u) {
                    this.ApplyBorrow(1);
                    this.Trim();
                }
            }
        }

Same methods

BigIntegerBuilder::Sub ( int &sign, BigIntegerBuilder &reg ) : void

Usage Example

Пример #1
0
        /// <summary>Adds the values of two specified <see cref="BigInteger" /> objects.</summary>
        /// <returns>The sum of <paramref name="left" /> and <paramref name="right" />.</returns>
        /// <param name="left">The first value to add.</param>
        /// <param name="right">The second value to add.</param>
        public static BigInteger operator +(BigInteger left, BigInteger right)
        {
            if (right.IsZero)
            {
                return(left);
            }

            if (left.IsZero)
            {
                return(right);
            }

            var signLeft  = 1;
            var signRight = 1;
            var regLeft   = new BigIntegerBuilder(left, ref signLeft);
            var regRight  = new BigIntegerBuilder(right, ref signRight);

            if (signLeft != signRight)
            {
                regLeft.Sub(ref signLeft, ref regRight);
            }
            else
            {
                regLeft.Add(ref regRight);
            }

            return(regLeft.GetInteger(signLeft));
        }
All Usage Examples Of System.Numerics.BigIntegerBuilder::Sub