java.lang.Object | +----Fraction
This is the class for fractions - i.e. ratios of integers. A fraction is reduced at all times.
Here is a sample program. It reads the first argument on the command line as a fraction, and the second as a natural number n. It then displays the decimal expansion of the fraction up through n digits after the decimal point.
Here is another sample program. It reads the first argument on the command line as a natural number n, sums n terms of the series 1 + 1/2 + ... + 1/n, and displays it as a fraction.
Eventually this file will contain tools for fractional arithmetic. At the moment it handles only input and output.
public int num[]den
public int den[]sign
public int sign
public Fraction(String s) throws NumberFormatException
public Fraction(MPInt x, MPInt y)
public Fraction(int x[], int y[])Fraction
public Fraction(long n, long d)
public String toDecimalString(int n)
public String toString()