public class Rational
extends java.lang.Number
implements java.lang.Comparable
Constructor and Description |
---|
Rational(java.math.BigInteger num) |
Rational(java.math.BigInteger num,
java.math.BigInteger den)
Rationals will always be represented in most reduced
form with a positive denominator.
|
Modifier and Type | Method and Description |
---|---|
Rational |
add(Rational arg) |
int |
compareTo(java.lang.Object arg) |
Rational |
div(Rational arg) |
double |
doubleValue() |
float |
floatValue() |
java.math.BigInteger |
getDenominator()
* Returns the bottom half of the rational.
|
java.math.BigInteger |
getNumerator()
Returns the top half of the rational.
|
int |
intValue() |
Rational |
inverse() |
long |
longValue() |
Rational |
mul(Rational arg) |
Rational |
negate() |
Rational |
pow(Rational arg) |
Rational |
sub(Rational arg) |
java.lang.String |
toString() |
static java.lang.Number |
valueOf(java.lang.String s) |
public Rational(java.math.BigInteger num)
public Rational(java.math.BigInteger num, java.math.BigInteger den)
public int intValue()
intValue
in class java.lang.Number
public long longValue()
longValue
in class java.lang.Number
public float floatValue()
floatValue
in class java.lang.Number
public double doubleValue()
doubleValue
in class java.lang.Number
public Rational negate()
public Rational inverse()
public static java.lang.Number valueOf(java.lang.String s)
public java.math.BigInteger getDenominator()
public java.math.BigInteger getNumerator()
public java.lang.String toString()
toString
in class java.lang.Object
public int compareTo(java.lang.Object arg)
compareTo
in interface java.lang.Comparable
http://www.singularsys.com/jep Copyright © 2007 Singular Systems