Package java.math

Examples of java.math.BigInteger.shiftLeft()


        while(!((r0.equals(ECConstants.ZERO)) && (r1.equals(ECConstants.ZERO))))
        {
            // If r0 is odd
            if (r0.testBit(0))
            {
                u[i] = (byte) ECConstants.TWO.subtract((r0.subtract(r1.shiftLeft(1))).mod(ECConstants.FOUR)).intValue();

                // r0 = r0 - u[i]
                if (u[i] == 1)
                {
                    r0 = r0.clearBit(0);
View Full Code Here


  {
    harness.checkPoint ("shift");
    BigInteger x =
      new BigInteger ("-50123044517898350982301255831878893568", 10);
    harness.check (x.shiftRight(64).toString(), "-2717175687894652269");
    harness.check (x.shiftLeft(-64).toString(), "-2717175687894652269");
    harness.check (x.shiftRight(1).toString(),
      "-25061522258949175491150627915939446784");
    harness.check (x.shiftLeft(1).toString(),
      "-100246089035796701964602511663757787136");
View Full Code Here

      new BigInteger ("-50123044517898350982301255831878893568", 10);
    harness.check (x.shiftRight(64).toString(), "-2717175687894652269");
    harness.check (x.shiftLeft(-64).toString(), "-2717175687894652269");
    harness.check (x.shiftRight(1).toString(),
      "-25061522258949175491150627915939446784");
    harness.check (x.shiftLeft(1).toString(),
      "-100246089035796701964602511663757787136");

    harness.check (x.shiftRight(0).toString(), x.toString());
    harness.check (x.shiftLeft(0).toString(), x.toString());
View Full Code Here

      "-25061522258949175491150627915939446784");
    harness.check (x.shiftLeft(1).toString(),
      "-100246089035796701964602511663757787136");

    harness.check (x.shiftRight(0).toString(), x.toString());
    harness.check (x.shiftLeft(0).toString(), x.toString());

    x = new BigInteger ("50123044517898350982301255831878893568", 10);
    harness.check (x.shiftRight(64).toString(), "2717175687894652268");
    harness.check (x.shiftLeft(-64).toString(), "2717175687894652268");
    harness.check (x.shiftRight(1).toString(),
View Full Code Here

    harness.check (x.shiftRight(0).toString(), x.toString());
    harness.check (x.shiftLeft(0).toString(), x.toString());

    x = new BigInteger ("50123044517898350982301255831878893568", 10);
    harness.check (x.shiftRight(64).toString(), "2717175687894652268");
    harness.check (x.shiftLeft(-64).toString(), "2717175687894652268");
    harness.check (x.shiftRight(1).toString(),
      "25061522258949175491150627915939446784");
    harness.check (x.shiftLeft(1).toString(),
      "100246089035796701964602511663757787136");
  }
View Full Code Here

    x = new BigInteger ("50123044517898350982301255831878893568", 10);
    harness.check (x.shiftRight(64).toString(), "2717175687894652268");
    harness.check (x.shiftLeft(-64).toString(), "2717175687894652268");
    harness.check (x.shiftRight(1).toString(),
      "25061522258949175491150627915939446784");
    harness.check (x.shiftLeft(1).toString(),
      "100246089035796701964602511663757787136");
  }
}
View Full Code Here

  }

  public BigInteger getBigInteger() {
    BigInteger result = BigInteger.ZERO;
    for (int i = this.size - 1; i >= 0; i--) {
      result = result.shiftLeft(1);
      if (this.get(i)) {
        result = result.add(BigInteger.ONE);
      }
    }
    return result;
View Full Code Here

                        /* test whether a^(d*2^r) = -1 (mod n), 0<=r<s
                        */
                        for(int r=0; r < s ; r++)
                        {
                                if ( a.modPow(d.shiftLeft(r),n).compareTo(q) == 0 )
                                        return true ;
                        }
                        return false ;
                }
        }
View Full Code Here

                 */
                //System.out.print("A("+(2 * n + 1)+"):");
                BigDecimal c = zeta(2 * n + 1, mcloc,bern_cache,fact_cache).subtract(BigDecimal.ONE,mcloc);
                //System.out.print("B");
                BigInteger fourn = new BigInteger("" + (2 * n + 1));
                fourn = fourn.shiftLeft(2 * n);
                c = c.divide(new BigDecimal(fourn),mcloc);
                resul = resul.subtract(c,mcloc);
                //if (c.doubleValue() < 0.1 * eps)                      // removed by l.bruninx, 2012-03-26
                //    break;                                            // removed by l.bruninx, 2012-03-26
               
View Full Code Here

     * @throws Exception
     */
    public Node external_lshift(Node startAt) throws Exception {
        startAt.isGoodArgsCnt(2);
        BigInteger r = number.get();
        r = r.shiftLeft((int) startAt.getSubNode(1, Node.TYPE_NUMBER).getNumber());
        return Node.createExternal(new External_Integer(r));
    }

    /**
     * surcharge de l'opérateur lshift!
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.