BigRational implements Comparable<BigRational> { public boolean isZero() { return numerator.signum() == 0; } private  BigRational(int value); private  BigRational(BigDecimal num, BigDecimal denom); BigInteger getNumeratorBigInteger(); BigDecimal getNumerator(); BigInteger getDenominatorBigInteger(); BigDecimal getDenominator(); BigRational reduce(); BigRational integerPart(); BigRational fractionPart(); BigRational negate(); BigRational reciprocal(); BigRational abs(); int signum(); BigRational increment(); BigRational decrement(); BigRational add(BigRational value); BigRational add(BigInteger value); BigRational add(int value); BigRational subtract(BigRational value); BigRational subtract(BigInteger value); BigRational subtract(int value); BigRational multiply(BigRational value); BigRational multiply(BigInteger value); BigRational multiply(int value); BigRational divide(BigRational value); BigRational divide(BigInteger value); BigRational divide(int value); boolean isZero(); boolean isInteger(); BigRational pow(int exponent); BigRational withPrecision(int precision); BigRational withScale(int scale); double toDouble(); float toFloat(); BigDecimal toBigDecimal(); BigDecimal toBigDecimal(MathContext mc); @Override int compareTo(BigRational other); @Override int hashCode(); @Override boolean equals(Object obj); @Override String toString(); String toPlainString(); String toRationalString(); String toIntegerRationalString(); static BigRational valueOf(int value); static BigRational valueOf(int numerator, int denominator); static BigRational valueOf(int integer, int fractionNumerator, int fractionDenominator); static BigRational valueOf(BigInteger numerator, BigInteger denominator); static BigRational valueOf(BigInteger value); static BigRational valueOf(double value); static BigRational valueOf(BigDecimal value); static BigRational valueOf(String string); static BigRational valueOf(boolean positive, String integerPart, String fractionPart, String fractionRepeatPart, String exponentPart); static BigRational valueOf(BigDecimal numerator, BigDecimal denominator); static BigRational min(BigRational... values); static BigRational max(BigRational... values); static BigRational bernoulli(int n); static final BigRational ZERO; static final BigRational ONE; static final BigRational TWO; static final BigRational TEN; }
@Test public void testIsZero() { assertEquals(true, valueOf(0).isZero()); assertEquals(false, valueOf(1).isZero()); assertEquals(false, valueOf(0.5).isZero()); assertEquals(false, valueOf(-1).isZero()); assertEquals(false, valueOf(-0.5).isZero()); }