Lines Matching refs:b1
82 * Print sum of b1 and b2; correct result will not throw an
85 private static int addWithoutException(BigDecimal b1, BigDecimal b2, MathContext mc) {
90 BigDecimal sum = b1.add(b2, mc);
91 printAddition(b1, b2, sum.toString());
94 printAddition(b1, b2, "Exception!");
198 private static void printAddition(BigDecimal b1, BigDecimal b2, String s) {
199 System.out.println("" + b1+ "\t+\t" + b2 + "\t=\t" + s);
202 private static int roundAway(BigDecimal b1, BigDecimal b2) {
205 b1.precision();
208 BigDecimal b1_negate = b1.negate();
214 failures += roundAway1(b1, b2);
215 failures += roundAway1(b1, b2_negate);
222 private static int roundAway1(BigDecimal b1, BigDecimal b2) {
224 failures += roundAway0(b1, b2);
225 failures += roundAway0(b2, b1);
230 * Compare b1.add(b2, mc) with b1.add(b2).round(mc) for a variety
233 private static int roundAway0(BigDecimal b1, BigDecimal b2) {
235 BigDecimal exactSum = b1.add(b2);
243 BigDecimal sum = b1.add(b2, mc);
250 printAddition(b1, b2, sum.toString());
254 // printAddition(b1, b2, sum.toString());
258 printAddition(b1, b2, "Exception!");