Home | History | Annotate | Download | only in creals

Lines Matching refs:BigInteger

122 import java.math.BigInteger;
155 * <TT>java.math.BigInteger</tt>. No subclasses of <TT>CR</tt>
211 static final BigInteger big0 = BigInteger.ZERO;
212 static final BigInteger big1 = BigInteger.ONE;
213 static final BigInteger bigm1 = BigInteger.valueOf(-1);
214 static final BigInteger big2 = BigInteger.valueOf(2);
215 static final BigInteger bigm2 = BigInteger.valueOf(-2);
216 static final BigInteger big3 = BigInteger.valueOf(3);
217 static final BigInteger big6 = BigInteger.valueOf(6);
218 static final BigInteger big8 = BigInteger.valueOf(8);
219 static final BigInteger big10 = BigInteger.TEN;
220 static final BigInteger big750 = BigInteger.valueOf(750);
221 static final BigInteger bigm750 = BigInteger.valueOf(-750);
244 protected abstract BigInteger approximate(int precision);
248 transient BigInteger max_appr;
277 * <TT>BigInteger</tt>.
279 public static CR valueOf(BigInteger n) {
288 return valueOf(BigInteger.valueOf(n));
296 return valueOf(BigInteger.valueOf(n));
337 static BigInteger shift(BigInteger k, int n) {
344 static BigInteger scale(BigInteger k, int n) {
348 BigInteger adj_k = shift(k, n+1).add(big1);
363 public synchronized BigInteger get_appr(int precision) {
368 BigInteger
503 BigInteger this_appr = get_appr(needed_prec);
504 BigInteger x_appr = x.get_appr(needed_prec);
540 BigInteger this_appr = get_appr(needed_prec);
586 BigInteger scaled_result = new BigInteger(whole + fraction, radix);
587 BigInteger divisor = BigInteger.valueOf(radix).pow(fraction.length());
603 BigInteger scale_factor = BigInteger.valueOf(radix).pow(n);
606 BigInteger scaled_int = scaled_CR.get_appr(0);
664 BigInteger big_radix = BigInteger.valueOf(radix);
684 BigInteger scaled_int = scaled_res.get_appr(0);
704 * Return a BigInteger which differs by less than one from the
707 public BigInteger BigIntegerValue() {
888 BigInteger rough_appr = get_appr(low_prec);
905 // This implementation may also be faster for BigInteger implementations
920 BigInteger halfpi_multiples = divide(PI).get_appr(-1);
921 BigInteger abs_halfpi_multiples = halfpi_multiples.abs();
924 BigInteger pi_multiples = scale(halfpi_multiples, -1);
951 BigInteger rough_appr = get_appr(-10);
969 static final BigInteger low_ln_limit = big8; /* sixteenths, i.e. 1/2 */
970 static final BigInteger high_ln_limit =
971 BigInteger.valueOf(16 + 8 /* 1.5 */);
972 static final BigInteger scaled_4 =
973 BigInteger.valueOf(4*16);
980 BigInteger rough_appr = get_appr(low_prec); /* In sixteenths */
1023 public synchronized BigInteger get_appr(int precision) {
1030 BigInteger result = approximate(eval_prec);
1042 BigInteger value;
1043 int_CR(BigInteger n) {
1046 protected BigInteger approximate(int p) {
1059 protected BigInteger approximate(int p) {
1076 protected BigInteger approximate(int p) {
1092 protected BigInteger approximate(int p) {
1103 protected BigInteger approximate(int p) {
1123 protected BigInteger approximate(int p) {
1126 BigInteger op1_appr = op1.get_appr(p-1);
1127 BigInteger op2_appr = op2.get_appr(p-1);
1128 BigInteger diff = op1_appr.subtract(op2_appr).abs();
1153 protected BigInteger approximate(int p) {
1181 BigInteger appr2 = op2.get_appr(prec2);
1185 BigInteger appr1 = op1.get_appr(prec1);
1196 protected BigInteger approximate(int p) {
1216 BigInteger dividend = big1.shiftLeft(log_scale_factor);
1217 BigInteger scaled_divisor = op.get_appr(prec_needed);
1218 BigInteger abs_scaled_divisor = scaled_divisor.abs();
1219 BigInteger adj_dividend = dividend.add(
1222 BigInteger result = adj_dividend.divide(abs_scaled_divisor);
1240 protected BigInteger approximate(int p) {
1251 BigInteger op_appr = op.get_appr(op_prec);
1257 BigInteger scaled_1 = big1.shiftLeft(-calc_precision);
1258 BigInteger current_term = scaled_1;
1259 BigInteger current_sum = scaled_1;
1261 BigInteger max_trunc_error =
1268 current_term = current_term.divide(BigInteger.valueOf(n));
1282 protected BigInteger approximate(int p) {
1293 BigInteger op_appr = op.get_appr(op_prec);
1299 BigInteger current_term;
1301 BigInteger max_trunc_error =
1305 BigInteger current_sum = current_term;
1312 BigInteger divisor = BigInteger.valueOf(-n)
1313 .multiply(BigInteger.valueOf(n-1));
1327 protected BigInteger approximate(int p) {
1342 BigInteger scaled_1 = big1.shiftLeft(-calc_precision);
1343 BigInteger big_op = BigInteger.valueOf(op);
1344 BigInteger big_op_squared = BigInteger.valueOf(op*op);
1345 BigInteger op_inverse = scaled_1.divide(big_op);
1346 BigInteger current_power = op_inverse;
1347 BigInteger current_term = op_inverse;
1348 BigInteger current_sum = op_inverse;
1351 BigInteger max_trunc_error =
1359 current_power.divide(BigInteger.valueOf(current_sign*n));
1378 protected BigInteger approximate(int p) {
1388 BigInteger op_appr = op.get_appr(op_prec);
1390 BigInteger x_nth = scale(op_appr, op_prec - calc_precision);
1391 BigInteger current_term = x_nth; // x**n
1392 BigInteger current_sum = current_term;
1395 BigInteger max_trunc_error =
1402 current_term = x_nth.divide(BigInteger.valueOf(n * current_sign));
1417 protected BigInteger approximate(int p) {
1441 BigInteger op_appr = op.get_appr(op_prec);
1453 BigInteger max_last_term =
1456 BigInteger current_term = op_appr.shiftLeft(op_prec - calc_precision);
1457 BigInteger current_sum = current_term;
1458 BigInteger current_factor = current_term;
1472 current_factor = current_factor.multiply(BigInteger.valueOf(exp - 2));
1477 BigInteger divisor = BigInteger.valueOf(exp - 1);
1484 current_term = current_factor.divide(BigInteger.valueOf(exp));
1500 sqrt_CR(CR x, int min_p, BigInteger max_a) {
1510 protected BigInteger approximate(int p) {
1524 BigInteger op_appr = op.get_appr(prod_prec);
1525 BigInteger last_appr = get_appr(appr_prec);
1528 BigInteger prod_prec_scaled_numerator =
1530 BigInteger scaled_numerator =
1532 BigInteger shifted_result = scaled_numerator.divide(last_appr);
1539 BigInteger scaled_bi_appr = op.get_appr(op_prec)
1545 BigInteger scaled_sqrt = BigInteger.valueOf((long)scaled_fp_sqrt);
1572 ArrayList<BigInteger> b_val = new ArrayList<BigInteger>();
1577 private static BigInteger TOLERANCE = BigInteger.valueOf(4);
1581 protected BigInteger approximate(int p) {
1588 if (p >= 0) return scale(BigInteger.valueOf(3), -p);
1597 BigInteger a = BigInteger.ONE.shiftLeft(-eval_prec);
1598 BigInteger b = SQRT_HALF.get_appr(eval_prec);
1599 BigInteger t = BigInteger.ONE.shiftLeft(-eval_prec - 2);
1604 final BigInteger next_a = a.add(b).shiftRight(1);
1605 final BigInteger next_b;
1606 final BigInteger a_diff = a.subtract(next_a);
1607 final BigInteger b_prod = a.multiply(b).shiftRight(-eval_prec);
1609 // temporary CR computation, to avoid implementing BigInteger
1619 final BigInteger scaled_next_b = scale(next_b, -extra_eval_prec);
1634 final BigInteger next_t =
1642 final BigInteger sum = a.add(b);
1643 final BigInteger result = sum.multiply(sum).divide(t).shiftRight(2);