BigReal implements FieldElement<BigReal>, Comparable<BigReal>, Serializable { public BigReal divide(BigReal a) throws MathArithmeticException { try { return new BigReal(d.divide(a.d, scale, roundingMode)); } catch (ArithmeticException e) { throw new MathArithmeticException(LocalizedFormats.ZERO_NOT_ALLOWED); } } BigReal(BigDecimal val);  BigReal(BigInteger val);  BigReal(BigInteger unscaledVal, int scale);  BigReal(BigInteger unscaledVal, int scale, MathContext mc);  BigReal(BigInteger val, MathContext mc);  BigReal(char[] in);  BigReal(char[] in, int offset, int len);  BigReal(char[] in, int offset, int len, MathContext mc);  BigReal(char[] in, MathContext mc);  BigReal(double val);  BigReal(double val, MathContext mc);  BigReal(int val);  BigReal(int val, MathContext mc);  BigReal(long val);  BigReal(long val, MathContext mc);  BigReal(String val);  BigReal(String val, MathContext mc); RoundingMode getRoundingMode(); void setRoundingMode(RoundingMode roundingMode); int getScale(); void setScale(int scale); BigReal add(BigReal a); BigReal subtract(BigReal a); BigReal negate(); BigReal divide(BigReal a); BigReal reciprocal(); BigReal multiply(BigReal a); BigReal multiply(final int n); int compareTo(BigReal a); double doubleValue(); BigDecimal bigDecimalValue(); @Override boolean equals(Object other); @Override int hashCode(); Field<BigReal> getField(); static final BigReal ZERO; static final BigReal ONE; }
@Test public void testDivide() { BigReal a = new BigReal("1.0000000000"); BigReal b = new BigReal("0.0009765625"); Assert.assertEquals(1024.0, a.divide(b).doubleValue(), 1.0e-15); }
@Test(expected = MathArithmeticException.class) public void testDivisionByZero() { final BigReal a = BigReal.ONE; final BigReal b = BigReal.ZERO; a.divide(b); }