Inheritance: java.lang.Number
Esempio n. 1
0
 public void testRandPrim512()
 {
     for(int i = 0; i < cycles; i++)
     {
         BigInteger bigPrime = new BigInteger (big512,1,secRand);
     }
 }
Esempio n. 2
0
 public void testEncryptBlock()
 {
     for (int i = 0; i < cycles; i++) {
         BigInteger nBig = new BigInteger (nVal);
         encBlock = encryptBlock (data, nBig);
     }
 }
Esempio n. 3
0
 public void testRandPrim2048()
 {
     for(int i = 0; i < cycles; i++)
     {
         BigInteger bigPrime = new BigInteger (big2048,5,secRand);
     }
 }
Esempio n. 4
0
 /// <summary>Generate a prime number with half size of keyBitSize</summary>
 public void run()
 {
     do
     {
         prime = new BigInteger(halfKeyBitSize - 1, 1, scRandom);
     }
     while (!(core.getPrimetest().isPrime(prime)) || prime.toByteArray().Length != keyByteSize);
 }
Esempio n. 5
0
 public void testDecryptBlock()
 {
     for (int i = 0; i < cycles; i++) {
         BigInteger nBig = new BigInteger (nVal);
         BigInteger dBig = new BigInteger (dVal);
         decBlock = decryptBlock (encBlock,nBig,dBig);
     }
 }
 // Expected tree for function: ^(FUNC ID ( INT | ID ) expr)
 /** Set up a local evaluator for a nested function call. The evaluator gets the definition
  *  tree of the function; the set of all defined functions (to find locally called ones); a
  *  pointer to the global variable memory; and the value of the function parameter to be
  *  added to the local memory.
  */
 private ProfileTreeGrammar( CommonTree function,
              List<CommonTree> functionDefinitions,
              IDictionary<string, BigInteger> globalMemory,
              BigInteger paramValue )
     : this(new CommonTreeNodeStream( function.GetChild( 2 ) ), functionDefinitions)
 {
     this.globalMemory = globalMemory;
     localMemory[function.GetChild( 1 ).Text] = paramValue;
 }
Esempio n. 7
0
 /** Set up a local evaluator for a nested function call. The evaluator gets the definition
  *  tree of the function; the set of all defined functions (to find locally called ones); a
  *  pointer to the global variable memory; and the value of the function parameter to be
  *  added to the local memory.
  */
 private DebugTreeGrammar(CommonTree function,
                          List <CommonTree> functionDefinitions,
                          IDictionary <string, BigInteger> globalMemory,
                          BigInteger paramValue)
 // Expected tree for function: ^(FUNC ID ( INT | ID ) expr)
     : this(new CommonTreeNodeStream(function.GetChild(2)), functionDefinitions)
 {
     this.globalMemory = globalMemory;
     localMemory[function.GetChild(1).Text] = paramValue;
 }
 /** Set up a local evaluator for a nested function call. The evaluator gets the definition
  *  tree of the function; the set of all defined functions (to find locally called ones); a
  *  pointer to the global variable memory; and the value of the function parameter to be
  *  added to the local memory.
  */
 private DebugTreeGrammar( CommonTree function,
              List<CommonTree> functionDefinitions,
              IDictionary<string, BigInteger> globalMemory,
              BigInteger paramValue )
     // Expected tree for function: ^(FUNC ID ( INT | ID ) expr)
     : this( new CommonTreeNodeStream( function.GetChild( 2 ) ), functionDefinitions )
 {
     this.globalMemory = globalMemory;
     localMemory[function.GetChild( 1 ).Text] = paramValue;
 }
Esempio n. 9
0
        public void ReduceOnBigIntReducesSmallerValues()
        {
            BigInteger b1 = new BigInteger("123");
            BigInteger b2 = new BigInteger("0");
            BigInteger b3 = new BigInteger(Int32.MaxValue.ToString());
            BigInteger b4 = new BigInteger(Int32.MinValue.ToString());

            ExpectInt32(Numbers.reduce(b1));
            ExpectInt32(Numbers.reduce(b2));
            ExpectInt32(Numbers.reduce(b3));
            ExpectInt32(Numbers.reduce(b4));
        }
Esempio n. 10
0
        public void ReduceOnBigIntReturnsLargerValues()
        {
            BigInteger b1 = new BigInteger("100000000000000000000", 16);
            BigInteger b2 = b1.negate();
            BigInteger b3 = new BigInteger("123456789012345678901234567890");
            BigInteger b4 = b3.negate();

            ExpectSameObject(b1, Numbers.reduce(b1));
            ExpectSameObject(b2, Numbers.reduce(b2));
            ExpectSameObject(b3, Numbers.reduce(b3));
            ExpectSameObject(b4, Numbers.reduce(b4));
        }
        // https://sites.google.com/a/jsc-solutions.net/backlog/knowledge-base/2015/201511/20151103/rsaparameters
        // https://sites.google.com/a/jsc-solutions.net/backlog/knowledge-base/2014/201408/20140829

        public RSAPrivateCrtKeySpec(BigInteger modulus,
                     BigInteger publicExponent,
                     BigInteger privateExponent,
                     BigInteger primeP,
                     BigInteger primeQ,
                     BigInteger primeExponentP,
                     BigInteger primeExponentQ,
                     BigInteger crtCoefficient) : base(modulus, privateExponent)
        {


        }
Esempio n. 12
0
 /// <summary>Test the input number to be probability a prime number.</summary>
 /// <remarks>Test the input number to be probability a prime number.</remarks>
 /// <param name="number">Number for prime test</param>
 /// <returns>
 /// Return true is a probability a prime and false if sure not a
 /// prime
 /// </returns>
 public virtual bool isPrime(BigInteger number)
 {
     bool result = false;
     SecureRandom random = new SecureRandom();
     for (int i = 0; i < this.rounds; i++)
     {
         result = runMillerRabin(number, random);
     }
     if (result == false)
     {
         this.probability = 0;
     }
     else
     {
         this.probability = this.calcProbability(this.rounds);
     }
     return result;
 }
 /** Find matching function definition for a function name and parameter
  *  value. The first definition is returned where (a) the name matches
  *  and (b) the formal parameter agrees if it is defined as constant.
  */
 private CommonTree findFunction( string name, BigInteger paramValue )
 {
     foreach ( CommonTree f in functionDefinitions )
     {
         // Expected tree for f: ^(FUNC ID (ID | INT) expr)
         if ( f.GetChild( 0 ).Text.Equals( name ) )
         {
             // Check whether parameter matches
             CommonTree formalPar = (CommonTree)f.GetChild( 1 );
             if ( formalPar.Token.Type == INT
                 && !new BigInteger( formalPar.Token.Text ).Equals( paramValue ) )
             {
                 // Constant in formalPar list does not match actual value -> no match.
                 continue;
             }
             // Parameter (value for INT formal arg) as well as fct name agrees!
             return f;
         }
     }
     return null;
 }
Esempio n. 14
0
 /** Find matching function definition for a function name and parameter
  *  value. The first definition is returned where (a) the name matches
  *  and (b) the formal parameter agrees if it is defined as constant.
  */
 private CommonTree findFunction(string name, BigInteger paramValue)
 {
     foreach (CommonTree f in functionDefinitions)
     {
         // Expected tree for f: ^(FUNC ID (ID | INT) expr)
         if (f.GetChild(0).Text.Equals(name))
         {
             // Check whether parameter matches
             CommonTree formalPar = (CommonTree)f.GetChild(1);
             if (formalPar.Token.Type == INT &&
                 !new BigInteger(formalPar.Token.Text).Equals(paramValue))
             {
                 // Constant in formalPar list does not match actual value -> no match.
                 continue;
             }
             // Parameter (value for INT formal arg) as well as fct name agrees!
             return(f);
         }
     }
     return(null);
 }
Esempio n. 15
0
 public static object reduce(BigInteger val)
 {
     //return (val.bitLength() < 32) ? (object)val.intValue() : val;
     int bitLength = val.bitLength();
     return (bitLength < 32)
         ? (object)val.intValue()
         : (bitLength < 64)
             ? (object)val.longValue()
             : val;
 }
Esempio n. 16
0
 public static object BIDivide(BigInteger n, BigInteger d)
 {
     if (d.Equals(BigIntegerZero))
         throw new ArithmeticException("Divide by zero");
     BigInteger gcd = n.gcd(d);
     if (gcd.Equals(BigIntegerZero))
         return 0;
     n = n.divide(gcd);
     d = d.divide(gcd);
     if (d.Equals(BigIntegerOne))
         return reduce(n);
     return new Ratio((d.signum() < 0 ? n.negate() : n),
         (d.signum() < 0 ? d.negate() : d));
 }
Esempio n. 17
0
		/// <summary>
		/// Returns a BigInteger whose value is <tt>(this - val)</tt>.
		/// </summary>
		public BigInteger subtract(BigInteger @val)
		{
			return default(BigInteger);
		}
Esempio n. 18
0
		/// <summary>
		/// Returns a BigInteger whose value is <tt>(this<sup>-1</sup> mod m)</tt>.
		/// </summary>
		public BigInteger modInverse(BigInteger @m)
		{
			return default(BigInteger);
		}
Esempio n. 19
0
		/// <summary>
		/// Returns the minimum of this BigInteger and <tt>val</tt>.
		/// </summary>
		public BigInteger min(BigInteger @val)
		{
			return default(BigInteger);
		}
Esempio n. 20
0
		/// <summary>
		/// Returns an array of two BigIntegers containing <tt>(this / val)</tt>
		/// followed by <tt>(this % val)</tt>.
		/// </summary>
		public BigInteger[] divideAndRemainder(BigInteger @val)
		{
			return default(BigInteger[]);
		}
Esempio n. 21
0
		public void testBigInt1024() {
			for(int i = 0; i < cycles; i++)
			{
				BigInteger testBigInt = new BigInteger(big1024);
			}
		}
Esempio n. 22
0
		public void testBigInt2048() {
			for(int i = 0; i < cycles; i++)
			{
				BigInteger testBigInt = new BigInteger(big2048);
			}
		}
Esempio n. 23
0
        public static object matchNumber(string s)
        {
            Match m = intRE.Match(s);
            if ( m.Success )
            {
                if ( m.Groups[2].Success )
                    // matched 0 only
                    return 0;
                bool isNeg = m.Groups[1].Value == "-";
                string n = null;
                int radix = 10;
                if (m.Groups[3].Success)
                {
                    n = m.Groups[3].Value;
                    radix = 10;
                }
                else if (m.Groups[4].Success)
                {
                    n = m.Groups[4].Value;
                    radix = 16;
                }
                else if (m.Groups[5].Success)
                {
                    n = m.Groups[5].Value;
                    radix = 8;
                }
                else if (m.Groups[7].Success)
                {
                    n = m.Groups[7].Value;
                    radix = Int32.Parse(m.Groups[6].Value);
                }
                if (n == null)
                    return null;

                BigInteger bn = new BigInteger(n, radix);
                return Numbers.reduce(isNeg ? bn.negate() : bn);
            }
            m = floatRE.Match(s);

            if (m.Success)
            {
                return ( s[s.Length-1] == 'M' )
                    ? new BigDecimal( s.Substring(0,s.Length-1))  // TODO: Fix MS inadequacy
                    : (object)Double.Parse(s);
            }
            m = ratioRE.Match(s);
            if (m.Success)
            {
                // There is a bug in the BigInteger c-tor that causes it barf on a leading +.
                string numerString = m.Groups[1].Value;
                string denomString = m.Groups[2].Value;
                if (numerString[0] == '+')
                    numerString = numerString.Substring(1);
                return Numbers.BIDivide(new BigInteger(numerString), new BigInteger(denomString));
            }
            return null;
        }
Esempio n. 24
0
		/// <summary>
		/// Returns a BigInteger whose value is
		/// <tt>(this<sup>exponent</sup> mod m)</tt>.
		/// </summary>
		public BigInteger modPow(BigInteger @exponent, BigInteger @m)
		{
			return default(BigInteger);
		}
Esempio n. 25
0
		/// <summary>
		/// Returns a BigInteger whose value is <tt>(this * val)</tt>.
		/// </summary>
		public BigInteger multiply(BigInteger @val)
		{
			return default(BigInteger);
		}
Esempio n. 26
0
		/// <summary>
		/// Returns a BigInteger whose value is <tt>(this &amp; ~val)</tt>.
		/// </summary>
		public BigInteger andNot(BigInteger @val)
		{
			return default(BigInteger);
		}
Esempio n. 27
0
		/// <summary>
		/// Returns a BigInteger whose value is <tt>(this ^ val)</tt>.
		/// </summary>
		public BigInteger xor(BigInteger @val)
		{
			return default(BigInteger);
		}
Esempio n. 28
0
 private static byte[] encryptBlock(byte[] block, BigInteger n)
 {
     BigInteger blockInt = new BigInteger(block);
     if (blockInt.compareTo(BigInteger.ZERO) < 0)
     {
         blockInt = blockInt.modPow(E, n);
         return blockInt.multiply(BigInteger.valueOf(-1)).toByteArray();
     }
     else
     {
         return (blockInt).modPow(E, n).toByteArray();
     }
 }
    // $ANTLR end "prog"


    // $ANTLR start "stat"
    // BuildOptions\\ProfileTreeGrammar.g3:56:0: stat : ( expr | ^( '=' ID expr ) | ^( FUNC ( . )+ ) );
    private void stat(  )
    {
        CommonTree ID2   = null;
        BigInteger expr1 = default(BigInteger);
        BigInteger expr3 = default(BigInteger);

        try
        {
            dbg.EnterRule(GrammarFileName, "stat");
            if (RuleLevel == 0)
            {
                dbg.Commence();
            }
            IncRuleLevel();
            dbg.Location(56, -1);

            try
            {
                // BuildOptions\\ProfileTreeGrammar.g3:56:9: ( expr | ^( '=' ID expr ) | ^( FUNC ( . )+ ) )
                int alt3 = 3;
                try
                {
                    dbg.EnterDecision(3);

                    switch (input.LA(1))
                    {
                    case CALL:
                    case ID:
                    case INT:
                    case 10:
                    case 11:
                    case 14:
                    case 15:
                    case 16:
                    {
                        alt3 = 1;
                    }
                    break;

                    case 17:
                    {
                        alt3 = 2;
                    }
                    break;

                    case FUNC:
                    {
                        alt3 = 3;
                    }
                    break;

                    default:
                    {
                        NoViableAltException nvae = new NoViableAltException("", 3, 0, input);

                        dbg.RecognitionException(nvae);
                        throw nvae;
                    }
                    }
                }
                finally
                {
                    dbg.ExitDecision(3);
                }

                switch (alt3)
                {
                case 1:
                    dbg.EnterAlt(1);

                    // BuildOptions\\ProfileTreeGrammar.g3:56:9: expr
                    {
                        dbg.Location(56, 8);
                        PushFollow(Follow._expr_in_stat63);
                        expr1 = expr();

                        state._fsp--;

                        dbg.Location(56, 35);
                        string result = expr1.ToString();
                        Console.Out.WriteLine(expr1 + " (about " + result[0] + "*10^" + (result.Length - 1) + ")");
                    }
                    break;

                case 2:
                    dbg.EnterAlt(2);

                    // BuildOptions\\ProfileTreeGrammar.g3:59:9: ^( '=' ID expr )
                    {
                        dbg.Location(59, 8);
                        dbg.Location(59, 10);
                        Match(input, 17, Follow._17_in_stat98);

                        Match(input, TokenTypes.Down, null);
                        dbg.Location(59, 14);
                        ID2 = (CommonTree)Match(input, ID, Follow._ID_in_stat100);
                        dbg.Location(59, 17);
                        PushFollow(Follow._expr_in_stat102);
                        expr3 = expr();

                        state._fsp--;


                        Match(input, TokenTypes.Up, null);
                        dbg.Location(59, 35);
                        globalMemory[(ID2 != null?ID2.Text:null)] = expr3;
                    }
                    break;

                case 3:
                    dbg.EnterAlt(3);

                    // BuildOptions\\ProfileTreeGrammar.g3:60:9: ^( FUNC ( . )+ )
                    {
                        dbg.Location(60, 8);
                        dbg.Location(60, 10);
                        Match(input, FUNC, Follow._FUNC_in_stat128);

                        Match(input, TokenTypes.Down, null);
                        dbg.Location(60, 15);
                        // BuildOptions\\ProfileTreeGrammar.g3:60:16: ( . )+
                        int cnt2 = 0;
                        try
                        {
                            dbg.EnterSubRule(2);

                            for ( ; ;)
                            {
                                int alt2 = 2;
                                try
                                {
                                    dbg.EnterDecision(2);

                                    int LA2_0 = input.LA(1);

                                    if (((LA2_0 >= CALL && LA2_0 <= 17)))
                                    {
                                        alt2 = 1;
                                    }
                                    else if ((LA2_0 == UP))
                                    {
                                        alt2 = 2;
                                    }
                                }
                                finally
                                {
                                    dbg.ExitDecision(2);
                                }

                                switch (alt2)
                                {
                                case 1:
                                    dbg.EnterAlt(1);

                                    // BuildOptions\\ProfileTreeGrammar.g3:60:0: .
                                    {
                                        dbg.Location(60, 15);
                                        MatchAny(input);
                                    }
                                    break;

                                default:
                                    if (cnt2 >= 1)
                                    {
                                        goto loop2;
                                    }

                                    EarlyExitException eee2 = new EarlyExitException(2, input);
                                    dbg.RecognitionException(eee2);

                                    throw eee2;
                                }
                                cnt2++;
                            }
loop2:
                            ;
                        }
                        finally
                        {
                            dbg.ExitSubRule(2);
                        }


                        Match(input, TokenTypes.Up, null);
                    }
                    break;
                }
            }
            catch (RecognitionException re)
            {
                ReportError(re);
                Recover(input, re);
            }
            finally
            {
            }
            dbg.Location(61, 4);
        }
        finally
        {
            dbg.ExitRule(GrammarFileName, "stat");
            DecRuleLevel();
            if (RuleLevel == 0)
            {
                dbg.Terminate();
            }
        }

        return;
    }
Esempio n. 30
0
		/// <summary>
		/// Returns a BigInteger whose value is <tt>(this mod m</tt>).
		/// </summary>
		public BigInteger mod(BigInteger @m)
		{
			return default(BigInteger);
		}
    // $ANTLR end "stat"


    // $ANTLR start "expr"
    // BuildOptions\\ProfileTreeGrammar.g3:63:0: expr returns [BigInteger value] : ( ^( '+' a= expr b= expr ) | ^( '-' a= expr b= expr ) | ^( '*' a= expr b= expr ) | ^( '/' a= expr b= expr ) | ^( '%' a= expr b= expr ) | ID | INT | call );
    private BigInteger expr(  )
    {
        BigInteger value = default(BigInteger);

        CommonTree ID4   = null;
        CommonTree INT5  = null;
        BigInteger a     = default(BigInteger);
        BigInteger b     = default(BigInteger);
        BigInteger call6 = default(BigInteger);

        try
        {
            dbg.EnterRule(GrammarFileName, "expr");
            if (RuleLevel == 0)
            {
                dbg.Commence();
            }
            IncRuleLevel();
            dbg.Location(63, -1);

            try
            {
                // BuildOptions\\ProfileTreeGrammar.g3:64:9: ( ^( '+' a= expr b= expr ) | ^( '-' a= expr b= expr ) | ^( '*' a= expr b= expr ) | ^( '/' a= expr b= expr ) | ^( '%' a= expr b= expr ) | ID | INT | call )
                int alt4 = 8;
                try
                {
                    dbg.EnterDecision(4);

                    switch (input.LA(1))
                    {
                    case 16:
                    {
                        alt4 = 1;
                    }
                    break;

                    case 10:
                    {
                        alt4 = 2;
                    }
                    break;

                    case 14:
                    {
                        alt4 = 3;
                    }
                    break;

                    case 15:
                    {
                        alt4 = 4;
                    }
                    break;

                    case 11:
                    {
                        alt4 = 5;
                    }
                    break;

                    case ID:
                    {
                        alt4 = 6;
                    }
                    break;

                    case INT:
                    {
                        alt4 = 7;
                    }
                    break;

                    case CALL:
                    {
                        alt4 = 8;
                    }
                    break;

                    default:
                    {
                        NoViableAltException nvae = new NoViableAltException("", 4, 0, input);

                        dbg.RecognitionException(nvae);
                        throw nvae;
                    }
                    }
                }
                finally
                {
                    dbg.ExitDecision(4);
                }

                switch (alt4)
                {
                case 1:
                    dbg.EnterAlt(1);

                    // BuildOptions\\ProfileTreeGrammar.g3:64:9: ^( '+' a= expr b= expr )
                    {
                        dbg.Location(64, 8);
                        dbg.Location(64, 10);
                        Match(input, 16, Follow._16_in_expr172);

                        Match(input, TokenTypes.Down, null);
                        dbg.Location(64, 15);
                        PushFollow(Follow._expr_in_expr176);
                        a = expr();

                        state._fsp--;

                        dbg.Location(64, 22);
                        PushFollow(Follow._expr_in_expr180);
                        b = expr();

                        state._fsp--;


                        Match(input, TokenTypes.Up, null);
                        dbg.Location(64, 35);
                        value = a.add(b);
                    }
                    break;

                case 2:
                    dbg.EnterAlt(2);

                    // BuildOptions\\ProfileTreeGrammar.g3:65:9: ^( '-' a= expr b= expr )
                    {
                        dbg.Location(65, 8);
                        dbg.Location(65, 10);
                        Match(input, 10, Follow._10_in_expr200);

                        Match(input, TokenTypes.Down, null);
                        dbg.Location(65, 15);
                        PushFollow(Follow._expr_in_expr204);
                        a = expr();

                        state._fsp--;

                        dbg.Location(65, 22);
                        PushFollow(Follow._expr_in_expr208);
                        b = expr();

                        state._fsp--;


                        Match(input, TokenTypes.Up, null);
                        dbg.Location(65, 35);
                        value = a.subtract(b);
                    }
                    break;

                case 3:
                    dbg.EnterAlt(3);

                    // BuildOptions\\ProfileTreeGrammar.g3:66:9: ^( '*' a= expr b= expr )
                    {
                        dbg.Location(66, 8);
                        dbg.Location(66, 10);
                        Match(input, 14, Follow._14_in_expr228);

                        Match(input, TokenTypes.Down, null);
                        dbg.Location(66, 15);
                        PushFollow(Follow._expr_in_expr232);
                        a = expr();

                        state._fsp--;

                        dbg.Location(66, 22);
                        PushFollow(Follow._expr_in_expr236);
                        b = expr();

                        state._fsp--;


                        Match(input, TokenTypes.Up, null);
                        dbg.Location(66, 35);
                        value = a.multiply(b);
                    }
                    break;

                case 4:
                    dbg.EnterAlt(4);

                    // BuildOptions\\ProfileTreeGrammar.g3:67:9: ^( '/' a= expr b= expr )
                    {
                        dbg.Location(67, 8);
                        dbg.Location(67, 10);
                        Match(input, 15, Follow._15_in_expr256);

                        Match(input, TokenTypes.Down, null);
                        dbg.Location(67, 15);
                        PushFollow(Follow._expr_in_expr260);
                        a = expr();

                        state._fsp--;

                        dbg.Location(67, 22);
                        PushFollow(Follow._expr_in_expr264);
                        b = expr();

                        state._fsp--;


                        Match(input, TokenTypes.Up, null);
                        dbg.Location(67, 35);
                        value = a.divide(b);
                    }
                    break;

                case 5:
                    dbg.EnterAlt(5);

                    // BuildOptions\\ProfileTreeGrammar.g3:68:9: ^( '%' a= expr b= expr )
                    {
                        dbg.Location(68, 8);
                        dbg.Location(68, 10);
                        Match(input, 11, Follow._11_in_expr284);

                        Match(input, TokenTypes.Down, null);
                        dbg.Location(68, 15);
                        PushFollow(Follow._expr_in_expr288);
                        a = expr();

                        state._fsp--;

                        dbg.Location(68, 22);
                        PushFollow(Follow._expr_in_expr292);
                        b = expr();

                        state._fsp--;


                        Match(input, TokenTypes.Up, null);
                        dbg.Location(68, 35);
                        value = a.remainder(b);
                    }
                    break;

                case 6:
                    dbg.EnterAlt(6);

                    // BuildOptions\\ProfileTreeGrammar.g3:69:9: ID
                    {
                        dbg.Location(69, 8);
                        ID4 = (CommonTree)Match(input, ID, Follow._ID_in_expr311);
                        dbg.Location(69, 35);
                        value = getValue((ID4 != null?ID4.Text:null));
                    }
                    break;

                case 7:
                    dbg.EnterAlt(7);

                    // BuildOptions\\ProfileTreeGrammar.g3:70:9: INT
                    {
                        dbg.Location(70, 8);
                        INT5 = (CommonTree)Match(input, INT, Follow._INT_in_expr347);
                        dbg.Location(70, 35);
                        value = new BigInteger((INT5 != null?INT5.Text:null));
                    }
                    break;

                case 8:
                    dbg.EnterAlt(8);

                    // BuildOptions\\ProfileTreeGrammar.g3:71:9: call
                    {
                        dbg.Location(71, 8);
                        PushFollow(Follow._call_in_expr382);
                        call6 = call();

                        state._fsp--;

                        dbg.Location(71, 35);
                        value = call6;
                    }
                    break;
                }
            }
            catch (RecognitionException re)
            {
                ReportError(re);
                Recover(input, re);
            }
            finally
            {
            }
            dbg.Location(72, 4);
        }
        finally
        {
            dbg.ExitRule(GrammarFileName, "expr");
            DecRuleLevel();
            if (RuleLevel == 0)
            {
                dbg.Terminate();
            }
        }

        return(value);
    }
Esempio n. 32
0
		/// <summary>
		/// Returns a BigInteger whose value is the greatest common divisor of
		/// <tt>abs(this)</tt> and <tt>abs(val)</tt>.
		/// </summary>
		public BigInteger gcd(BigInteger @val)
		{
			return default(BigInteger);
		}
    // $ANTLR end "expr"


    // $ANTLR start "call"
    // BuildOptions\\ProfileTreeGrammar.g3:74:0: call returns [BigInteger value] : ^( CALL ID expr ) ;
    private BigInteger call(  )
    {
        BigInteger value = default(BigInteger);

        CommonTree ID8   = null;
        BigInteger expr7 = default(BigInteger);

        try
        {
            dbg.EnterRule(GrammarFileName, "call");
            if (RuleLevel == 0)
            {
                dbg.Commence();
            }
            IncRuleLevel();
            dbg.Location(74, -1);

            try
            {
                // BuildOptions\\ProfileTreeGrammar.g3:75:9: ( ^( CALL ID expr ) )
                dbg.EnterAlt(1);

                // BuildOptions\\ProfileTreeGrammar.g3:75:9: ^( CALL ID expr )
                {
                    dbg.Location(75, 8);
                    dbg.Location(75, 10);
                    Match(input, CALL, Follow._CALL_in_call430);

                    Match(input, TokenTypes.Down, null);
                    dbg.Location(75, 15);
                    ID8 = (CommonTree)Match(input, ID, Follow._ID_in_call432);
                    dbg.Location(75, 18);
                    PushFollow(Follow._expr_in_call434);
                    expr7 = expr();

                    state._fsp--;


                    Match(input, TokenTypes.Up, null);
                    dbg.Location(75, 35);
                    BigInteger p        = expr7;
                    CommonTree funcRoot = findFunction((ID8 != null?ID8.Text:null), p);
                    if (funcRoot == null)
                    {
                        Console.Error.WriteLine("No match found for " + (ID8 != null?ID8.Text:null) + "(" + p + ")");
                    }
                    else
                    {
                        // Here we set up the local evaluator to run over the
                        // function definition with the parameter value.
                        // This re-reads a sub-AST of our input AST!
                        ProfileTreeGrammar e = new ProfileTreeGrammar(funcRoot, functionDefinitions, globalMemory, p);
                        value = e.expr();
                    }
                }
            }
            catch (RecognitionException re)
            {
                ReportError(re);
                Recover(input, re);
            }
            finally
            {
            }
            dbg.Location(87, 4);
        }
        finally
        {
            dbg.ExitRule(GrammarFileName, "call");
            DecRuleLevel();
            if (RuleLevel == 0)
            {
                dbg.Terminate();
            }
        }

        return(value);
    }
Esempio n. 34
0
		public void testBigInt512() {
			for(int i = 0; i < cycles; i++)
			{
				BigInteger testBigInt = new BigInteger(big512);
			}
		}
Esempio n. 35
0
		/// <summary>
		/// Returns a BigInteger whose value is <tt>(this % val)</tt>.
		/// </summary>
		public BigInteger remainder(BigInteger @val)
		{
			return default(BigInteger);
		}