Examples of pow()


Examples of java.math.BigInteger.pow()

      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

Examples of java.math.BigInteger.pow()

      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

Examples of java.math.BigInteger.pow()

          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

Examples of java.math.BigInteger.pow()

    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

Examples of java.math.BigInteger.pow()

        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

Examples of java.math.BigInteger.pow()

       
        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

Examples of java.math.BigInteger.pow()

        return ConstantsSimulation.DEFAULT_MASTER_SCHEDULER_ID + "-primePolynome";
    }
   
    public static void main(String[] args) {
        BigInteger num = new BigInteger("10");
        num = num.pow(2000);
        num = num.multiply(new BigInteger("6"));
        num = num.subtract(new BigInteger("1"));
        System.out.println(num);
        System.out.println(num.isProbablePrime(Integer.MAX_VALUE));
    }
View Full Code Here

Examples of java.math.BigInteger.pow()

    public NodeValue exec(NodeValue v) {
        switch (XSDFuncOp.classifyNumeric("cube", v))
        {
            case OP_INTEGER:
                BigInteger i = v.getInteger();
                return NodeValue.makeInteger( i.pow(3) );
            case OP_DECIMAL:
                double dec = v.getDecimal().doubleValue() ;
                return NodeValue.makeDecimal( Math.pow(dec, 3d)) ;
            case OP_FLOAT:
                // TODO Should squaring a float keep it a float?
View Full Code Here

Examples of java.math.BigInteger.pow()

    public NodeValue exec(NodeValue v) {
        switch (XSDFuncOp.classifyNumeric("sq", v))
        {
            case OP_INTEGER:
                BigInteger i = v.getInteger();
                return NodeValue.makeInteger( i.pow(2) );
            case OP_DECIMAL:
                double dec = v.getDecimal().doubleValue() ;
                return NodeValue.makeDecimal( Math.pow(dec, 2d)) ;
            case OP_FLOAT:
                // TODO Should squaring a float keep it a float?
View Full Code Here

Examples of java.math.BigInteger.pow()

    public NodeValue exec(NodeValue v1, NodeValue v2) {
        switch (XSDFuncOp.classifyNumeric("pow", v1))
        {
            case OP_INTEGER:
                BigInteger i = v1.getInteger();
                return NodeValue.makeInteger( i.pow(v2.getInteger().intValue()) );
            case OP_DECIMAL:
                double dec = v1.getDecimal().doubleValue() ;
                return NodeValue.makeDecimal( Math.pow(dec, v2.getDouble())) ;
            case OP_FLOAT:
                // TODO Should raising a float to a power keep it a float?
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.