Package java.math

Examples of java.math.BigInteger.divide()


    long temp = rand.getHigh8();
    if (temp < 0) {
      // use biginteger to avoid the negative sign problem
      BigInteger bigTemp = makeBigInteger(temp);
      recBuf[0] = (byte) (' ' + (bigTemp.mod(NINETY_FIVE).longValue()));
      temp = bigTemp.divide(NINETY_FIVE).longValue();
    } else {
      recBuf[0] = (byte) (' ' + (temp % 95));
      temp /= 95;     
    }
    for(int i=1; i < 8; ++i) {
View Full Code Here


    }
    temp = rand.getLow8();
    if (temp < 0) {
      BigInteger bigTemp = makeBigInteger(temp);
      recBuf[8] = (byte) (' ' + (bigTemp.mod(NINETY_FIVE).longValue()));
      temp = bigTemp.divide(NINETY_FIVE).longValue();     
    } else {
      recBuf[8] = (byte) (' ' + (temp % 95));
      temp /= 95;
    }
    recBuf[9] = (byte)(' ' + (temp % 95));
View Full Code Here

        JDBC.assertSingleValueResultSet(st.executeQuery(sql),
                i.divide(y) + fraction);

        sql = "select y / " + i + " from " + tableName;
        JDBC.assertSingleValueResultSet(st.executeQuery(sql),
                y.divide(i).toString());

        st.close();
    }

    /**
 
View Full Code Here

       * correct answer eventually, but in practice this branch should almost never be entered,
       * and even then the loop should not run more than once.
       */
      do {
        approxLog10--;
        approxPow = approxPow.divide(BigInteger.TEN);
        approxCmp = approxPow.compareTo(x);
      } while (approxCmp > 0);
    } else {
      BigInteger nextPow = BigInteger.TEN.multiply(approxPow);
      int nextCmp = nextPow.compareTo(x);
View Full Code Here

    while (n.compareTo(p) >= 0) {
      // typically not reached
      p = p.multiply(BIG_INTEGER_TWO);
      exponent++;
    }
    p = p.divide(BIG_INTEGER_TWO);
    while (n.compareTo(p) < 0) {
      // typically not reached
      p = p.divide(BIG_INTEGER_TWO);
      exponent--;
    }
View Full Code Here

      exponent++;
    }
    p = p.divide(BIG_INTEGER_TWO);
    while (n.compareTo(p) < 0) {
      // typically not reached
      p = p.divide(BIG_INTEGER_TWO);
      exponent--;
    }

    // [possible loss of precision step]
    return exponent;
View Full Code Here

    // [rounding step, possible loss of precision step]
    BigInteger mantissa = value.bigIntegerValue();
    // adjust after [unfortunate] mantissa rounding
    if (upper.compareTo(mantissa) <= 0) {
      mantissa = mantissa.divide(BIG_INTEGER_TWO);
      exponent++;
    }

    // start [to fill] at the little end of the [bigendian] output
    int i = out0.length - 1;
View Full Code Here

                ++currentSize;
            } while (pointer != start);
            counter += currentSize;
            temp = BigInteger.valueOf(currentSize);
            //calculate l.c.m.
            lcm = (lcm.divide(lcm.gcd(temp))).multiply(temp);
        }
        return lcm;
    }

    /**
 
View Full Code Here

                ++currentSize;
            } while (pointer != start);
            counter += currentSize;
            temp = BigInteger.valueOf(currentSize);
            //calculate l.c.m.
            lcm = (lcm.divide(lcm.gcd(temp))).multiply(temp);
        }
        return lcm;
    }

    /**
 
View Full Code Here

                ++currentSize;
            } while (pointer != start);
            counter += currentSize;
            temp = BigInteger.valueOf(currentSize);
            //calculate l.c.m.
            lcm = (lcm.divide(lcm.gcd(temp))).multiply(temp);
        }
        return lcm;
    }

    /**
 
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.