Package java.math

Examples of java.math.BigInteger.pow()


 
  private static BigInteger generatingFunction(int n) {
    BigInteger sum = BigInteger.ZERO;
    BigInteger biN = BigInteger.valueOf(-n);
    for (int i = 0; i <= DEGREE; i++)
      sum = sum.add(biN.pow(i));
    return sum;
  }
 
}
View Full Code Here


      return BigInteger.valueOf(LongMath.sqrt(x.longValue(), mode));
    }
    BigInteger sqrtFloor = sqrtFloor(x);
    switch (mode) {
      case UNNECESSARY:
        checkRoundingUnnecessary(sqrtFloor.pow(2).equals(x)); // fall through
      case FLOOR:
      case DOWN:
        return sqrtFloor;
      case CEILING:
      case UP:
View Full Code Here

      case FLOOR:
      case DOWN:
        return sqrtFloor;
      case CEILING:
      case UP:
        return sqrtFloor.pow(2).equals(x) ? sqrtFloor : sqrtFloor.add(BigInteger.ONE);
      case HALF_DOWN:
      case HALF_UP:
      case HALF_EVEN:
        BigInteger halfSquare = sqrtFloor.pow(2).add(sqrtFloor);
        /*
 
View Full Code Here

    // capacity of 10 suffices for all x <= 10^(2^10).
    List<BigInteger> powersOf10 = new ArrayList<BigInteger>(10);
    BigInteger powerOf10 = BigInteger.TEN;
    while (x.compareTo(powerOf10) >= 0) {
      powersOf10.add(powerOf10);
      powerOf10 = powerOf10.pow(2);
    }
    BigInteger floorPow = BigInteger.ONE;
    int floorLog = 0;
    for (int i = powersOf10.size() - 1; i >= 0; i--) {
      BigInteger powOf10 = powersOf10.get(i);
View Full Code Here

      return BigInteger.valueOf(LongMath.sqrt(x.longValue(), mode));
    }
    BigInteger sqrtFloor = sqrtFloor(x);
    switch (mode) {
      case UNNECESSARY:
        checkRoundingUnnecessary(sqrtFloor.pow(2).equals(x)); // fall through
      case FLOOR:
      case DOWN:
        return sqrtFloor;
      case CEILING:
      case UP:
View Full Code Here

      case FLOOR:
      case DOWN:
        return sqrtFloor;
      case CEILING:
      case UP:
        return sqrtFloor.pow(2).equals(x) ? sqrtFloor : sqrtFloor.add(BigInteger.ONE);
      case HALF_DOWN:
      case HALF_UP:
      case HALF_EVEN:
        BigInteger halfSquare = sqrtFloor.pow(2).add(sqrtFloor);
        /*
 
View Full Code Here

          if (mv != null) {
            final BigInteger amount = mv.getAmount();
            final BigInteger exp = mv.getExponent();
            final BigInteger ten = BigInteger.valueOf(10);
            // A possibly gotcha here if the monetary value is larger than what fits in a long...
            final long value = amount.longValue() * (ten.pow(exp.intValue())).longValue();
            if (value < 0) {
              log.error("ETSI LimitValue amount is < 0.");
            }
            final String curr = mv.getCurrency().getAlphabetic();
            if (curr == null) {
View Full Code Here

    protected String generateValidID() throws MessageStoreException {
        String newID = generateID();

        // Create a loop limit of 10^idsize
        BigInteger limit = new BigInteger("10");
        limit = limit.pow(globalConfig.getIdSize());
        BigInteger count = new BigInteger("0");
        BigInteger increment = new BigInteger("1");

        // Repeat whilst the generated ID is invalid and the count < limit
        while (!checkValidID(newID) && (count.compareTo(limit) < 0)) {
View Full Code Here

        BigInteger base;
       
        for (int i = 0; i < coefficients.length; i++) {
            coeff = new BigInteger("" + coefficients[i]);
            base = new BigInteger(xValue.toString());
            base = base.pow(i);
            coeff = coeff.multiply(base);
            value = value.add(coeff);
        }
       
        lastCalc = new BigInteger(xValue.toString());
View Full Code Here

       
        System.out.println(p);
//        System.out.println(p.numDifferentPrimesInRange(100, false).wert + " + " + p.numDifferentPrimesInRange(100, false).doppelte);
       
        BigInteger prime = new BigInteger("10");
        prime = prime.pow(2000);
        prime = prime.multiply(new BigInteger("6"));
        prime = prime.add(new BigInteger("1"));
       
        BigPrimeFactor pf = new BigPrimeFactor();
        System.out.println(pf.getPrimeFactors(prime.toString()));
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.