@Test public void testToDouble() { assertEquals(0.0, valueOf(0).toDouble(), 0.0); assertEquals(123.0, valueOf(123.0).toDouble(), 0.0); assertEquals(123.4, valueOf(123.4).toDouble(), 0.0); assertEquals(-123.0, valueOf(-123.0).toDouble(), 0.0); assertEquals(-123.4, valueOf(-123.4).toDouble(), 0.0); }
public double toDouble() { return numerator.doubleValue() / denominator.doubleValue(); }
BigRational implements Comparable<BigRational> { public double toDouble() { return numerator.doubleValue() / denominator.doubleValue(); } }
BigRational implements Comparable<BigRational> { public double toDouble() { return numerator.doubleValue() / denominator.doubleValue(); } private  BigRational(int value); private  BigRational(BigDecimal num, BigDecimal denom); }
BigRational implements Comparable<BigRational> { public double toDouble() { return numerator.doubleValue() / denominator.doubleValue(); } 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); }
BigRational implements Comparable<BigRational> { public double toDouble() { return numerator.doubleValue() / denominator.doubleValue(); } 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; }