Package java.math

Examples of java.math.BigInteger.divide()


        boolean high;
        int U;
        while (true) {
            k--;
            BigInteger R10 = R.multiply(TEN);
            U = R10.divide(S).intValue();
            R = R10.mod(S);
            Mminus = Mminus.multiply(TEN);
            Mplus = Mplus.multiply(TEN);
            BigInteger R2 = R.shiftLeft(1);
            low = R2.compareTo(Mminus) < 0;
View Full Code Here


        boolean high;
        int U;
        while (true) {
            k--;
            BigInteger R10 = R.multiply(TEN);
            U = R10.divide(S).intValue();
            R = R10.mod(S);
            Mminus = Mminus.multiply(TEN);
            Mplus = Mplus.multiply(TEN);
            BigInteger R2 = R.shiftLeft(1);
            low = R2.compareTo(Mminus) < 0;
View Full Code Here

        if (scale >= 0) {
            return this;
        } else {
            BigInteger factor = BigInteger.valueOf(10).pow(-scale);
            BigInteger[] pair = value.divideAndRemainder(factor);
            int up = pair[1].compareTo(factor.divide(BigInteger.valueOf(2)));
            if (up > 0) {
                // remainder is > .5
                pair[0] = pair[0].add(BigInteger.valueOf(1));
            } else if (up == 0) {
                // remainder == .5
View Full Code Here

        boolean high;
        int U;
        while (true) {
            k--;
            final BigInteger R10 = R.multiply(TEN);
            U = R10.divide(S).intValue();
            R = R10.mod(S);
            Mminus = Mminus.multiply(TEN);
            Mplus = Mplus.multiply(TEN);
            final BigInteger R2 = R.shiftLeft(1);
            low = R2.compareTo(Mminus) < 0;
View Full Code Here

        boolean high;
        int U;
        while (true) {
            k--;
            final BigInteger R10 = R.multiply(TEN);
            U = R10.divide(S).intValue();
            R = R10.mod(S);
            Mminus = Mminus.multiply(TEN);
            Mplus = Mplus.multiply(TEN);
            final BigInteger R2 = R.shiftLeft(1);
            low = R2.compareTo(Mminus) < 0;
View Full Code Here

                y >>= 1;
            }
           
            BigInteger bigX = BigInteger.valueOf(x);
            BigInteger bigXZ = bigX.multiply(bigX);
            if (bigXZ.divide(bigX).longValue() != z) {
                IRubyObject v = RubyBignum.newBignum(runtime, RubyBignum.fix2big(RubyFixnum.newFixnum(runtime, x))).op_pow(context, RubyFixnum.newFixnum(runtime, y));
                if (z != 1) v = RubyBignum.newBignum(runtime, RubyBignum.fix2big(RubyFixnum.newFixnum(runtime, neg ? -z : z))).op_mul19(context, v);
                return v;
            }
            z = bigXZ.longValue();
View Full Code Here

      && (bi.compareTo(BigIntegerDecimal.MINLONG_MINUS_ONE) > 0))
      rangeOk = true;
     
    for (int i = 0; i < sqlScale; i++)
    {
      bi = bi.divide(BigIntegerDecimal.TEN);
      if (rangeOk)
        continue;
     
      if ((bi.compareTo(BigIntegerDecimal.MAXLONG_PLUS_ONE) < 0)
          && (bi.compareTo(BigIntegerDecimal.MINLONG_MINUS_ONE) > 0))
View Full Code Here

    for (int i = 0; i < n; i++)
      if (pow[i] > 0)
        det = det.multiply(b[i][i].pow(pow[i]));
    for (int i = 0; i < n; i++)
      if (pow[i] < 0)
        det = det.divide(b[i][i].pow(-pow[i]));
    if (sign < 0)
      det = det.negate();
    return det;
  }
View Full Code Here

    // this algorithm gives us the alphanumeric number in reverse order
    while (value.compareTo(BigInteger.ZERO) > 0)
    {
      int remainder = value.mod(sixtyTwo).intValue();
      sb.append(CONSTANT.ALPHANUMERIC_DIGITS[remainder]);
      value = value.divide(sixtyTwo);
    }

    // reverse result
    return StringUtils.reverse(sb.toString());
  }
View Full Code Here

    // this algorithm gives us the alphanumeric number in reverse order
    while (value.compareTo(BigInteger.ZERO) > 0)
    {
      int remainder = value.mod(sixtyTwo).intValue();
      sb.append(CONSTANT.ALPHANUMERIC_DIGITS[remainder]);
      value = value.divide(sixtyTwo);
    }

    // reverse result
    return StringUtils.reverse(sb.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.