Exemplo n.º 1
0
        public static void Divide(SLongIntD A, SLongIntD B, out SLongIntD Q, out SLongIntD R)
        {
            LongIntBase QNumber = new LongIntBase(A.Base);
            LongIntBase RNumber = new LongIntBase(B.Base);

            LSign resultSign = SignTransformer.GetLSign(A.Sign * B.Sign);

            LongMath.Divide(A, B, out QNumber, out RNumber, true, true);
            Q = new SLongIntD(QNumber, resultSign, ConstructorMode.Assign);
            R = new SLongIntD(RNumber, resultSign, ConstructorMode.Assign);
        }
Exemplo n.º 2
0
 /// <summary>
 /// Calculates A*A
 /// </summary>
 /// <param name="A">Long Number</param>
 /// <returns>Long number that is result of self-product of A</returns>
 public static SLongIntD Sqr(SLongIntD A)
 {
     return new SLongIntD(LongMath.InnerSqr(A), LSign.Positive, ConstructorMode.Assign);
 }
Exemplo n.º 3
0
 /// <summary>
 /// Finds absolute value of input number
 /// </summary>
 /// <param name="A">Input number</param>
 /// <returns>Absolute number of A</returns>
 public static SLongIntD Abs(SLongIntD A)
 {
     SLongIntD temp = new SLongIntD(A);
     SelfAbs(temp);
     return temp;
 }
Exemplo n.º 4
0
 public static SLongIntD Exp(SLongIntD A, ulong n)
 {
     return new SLongIntD(InnerPower(A, n),
                          SignTransformer.GetLSign(A.IsPositive || (n % 2 == 0)), ConstructorMode.Assign);
 }