Method Summary |
|
public void | add(long i) Adds an integer to this Rational value. |
public void | add(Rational r) Adds an integer to this Rational value. |
public static Rational | approximate(float f, float tol) Returns a Rational that is within the given tolerance
of a given float value. |
public static Rational | approximate(double f, double tol) Returns a Rational that is within the given tolerance
of a given double value. |
public static int | ceil(long num, long denom) |
public static Rational | createFromFrac(long[] terms, int len) Returns a Rational defined by a given number of terms
of a continued fraction:
terms[0] + 1
-------------------------
terms[1] + 1
--------------
terms[2] + ... |
public double | doubleValue() Returns the approximate double value of this Rational. |
public float | floatValue() Returns the approximate float value of this Rational. |
public static int | floor(long num, long denom) |
public void | invert() Inverts this Rational value. |
public static void | main(String[] args) Prints out rational approximations of a floating point argument
with 1 to 8 digits of accuracy. |
public void | multiply(long i) Multiplies an integer to this Rational value. |
public void | multiply(Rational r) Multiplies a Rational to this Rational value. |
public void | subtract(long i) Subtracts an int from this Rational value. |
public void | subtract(Rational r) Subtracts an integer to this Rational value. |
public String | toString() Returns this Rational as a String in the form '###/###'. |