|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjava.lang.Number
org.jscience.mathematics.algebraic.numbers.BigRational
public final class BigRational
BigRational: dynamically sized immutable arbitrary-precision rational numbers.
| Field Summary | |
|---|---|
static int |
DEFAULT_RADIX
Default radix, used in string printing and scanning, 10. |
static int |
DEFAULT_ROUND_MODE
Default round mode, ROUND_HALF_UP. |
static BigRational |
MINUS_ONE
The constant minus-one (-1). |
static BigRational |
ONE
The constant one (1). |
static int |
ROUND_CEILING
Rounding mode to round towards positive infinity. |
static int |
ROUND_DOWN
Rounding mode to round towards zero. |
static int |
ROUND_FLOOR
Rounding mode to round towards negative infinity. |
static int |
ROUND_HALF_CEILING
Rounding mode to round towards nearest neighbor unless both neighbors are equidistant, in which case to round ceiling. |
static int |
ROUND_HALF_DOWN
Rounding mode to round towards nearest neighbor unless both neighbors are equidistant, in which case to round down. |
static int |
ROUND_HALF_EVEN
Rounding mode to round towards the nearest neighbor unless both neighbors are equidistant, in which case to round towards the even neighbor. |
static int |
ROUND_HALF_FLOOR
Rounding mode to round towards nearest neighbor unless both neighbors are equidistant, in which case to round floor. |
static int |
ROUND_HALF_ODD
Rounding mode to round towards the nearest neighbor unless both neighbors are equidistant, in which case to round towards the odd neighbor. |
static int |
ROUND_HALF_UP
Rounding mode to round towards nearest neighbor unless both neighbors are equidistant, in which case to round up. |
static int |
ROUND_UNNECESSARY
Rounding mode to assert that the requested operation has an exact result, hence no rounding is necessary. |
static int |
ROUND_UP
Rounding mode to round away from zero. |
static BigRational |
ZERO
The constant zero (0). |
| Constructor Summary | |
|---|---|
BigRational(java.math.BigInteger n)
Construct a BigRational from a big number integer, denominator is 1. |
|
BigRational(java.math.BigInteger n,
java.math.BigInteger q)
Construct a BigRational from numerator and denominator. |
|
BigRational(java.math.BigInteger unscaledValue,
int scale)
Construct a BigRational from an unscaled value by scaling, default radix. |
|
BigRational(java.math.BigInteger unscaledValue,
int scale,
int radix)
Construct a BigRational from an unscaled value by scaling. |
|
BigRational(long n)
Construct a BigRational from a long fix number integer. |
|
BigRational(long unscaledValue,
int scale,
int radix)
Construct a BigRational from an unscaled fix number value by scaling. |
|
BigRational(long n,
long q)
Construct a BigRational from long fix number integers representing numerator and denominator. |
|
BigRational(java.lang.String s)
Construct a BigRational from a string representation, with default radix, the supported formats are "[+-]d/[+-]q", "[+-]i.f", "[+-]i". |
|
BigRational(java.lang.String s,
int radix)
Construct a BigRational from a string representation, the supported formats are "[+-]d/[+-]q", "[+-]i.f", "[+-]i". |
|
| Method Summary | |
|---|---|
BigRational |
abs()
Return a new BigRational with the absolute value of this. |
BigRational |
add(BigRational that)
Add two BigRationals and return a new BigRational. |
BigRational |
add(long that)
Add a BigRational and a long fix number integer and return a new BigRational. |
java.math.BigDecimal |
bigDecimalValue(int precision)
Convert to BigDecimal |
java.math.BigInteger |
bigIntegerValue()
Convert to BigInteger, by rounding. |
BigRational |
ceil()
Ceiling, round towards positive infinity. |
int |
compareTo(java.math.BigInteger that)
Compare to BigInteger. |
int |
compareTo(BigRational that)
Compare two BigRationals. |
int |
compareTo(long that)
Compare to long. |
int |
compareTo(java.lang.Object object)
Compare object (BigRational/BigInteger/Long/Integer). |
BigRational |
divide(BigRational that)
Divide a BigRational (this) through another and return a new BigRational. |
BigRational |
divide(long that)
Divide a BigRational (this) through a long fix number integer and return a new BigRational. |
double |
doubleValue()
Convert to double Implements Number.doubleValue(). |
boolean |
equals(java.lang.Object object)
Compare object for equality. |
float |
floatValue()
Convert to floatl. |
BigRational |
floor()
Floor, round towards negative infinity. |
BigRational |
fractionalPart()
Fractional part. |
java.math.BigInteger |
getDenominator()
Retrieves the denominator as a BigInteger. |
java.math.BigInteger |
getNumerator()
Retrieves the numerator as a BigInteger. |
int |
hashCode()
Hash code. |
BigRational[] |
integerAndFractionalPart()
Return an array of BigRationals with both integer and fractional part. |
BigRational |
integerPart()
Integer part. |
int |
intValue()
Convert to int, by rounding and delegating to BigInteger. |
BigRational |
invert()
Return a new BigRational with the inverted (reciprocal) value of this. |
long |
longValue()
Convert to long, by rounding and delegating to BigInteger. |
BigRational |
max(BigRational that)
Return the maximal value of two BigRationals. |
BigRational |
max(long that)
Return the maximum value of a BigRational and a long fix number integer. |
BigRational |
min(BigRational that)
Return the minimal value of two BigRationals. |
BigRational |
min(long that)
Return the minimal value of a BigRational and a long fix number integer. |
BigRational |
mod(BigRational that)
Calculate the modulus of two BigRationals and return a new BigRational. |
BigRational |
mod(long that)
Calculate the modulus of a BigRational and a long fix number integer and return a new BigRational. |
BigRational |
multiply(BigRational that)
Multiply two BigRationals and return a new BigRational. |
BigRational |
multiply(long that)
Multiply a long fix number integer to this and return a new BigRational. |
BigRational |
negate()
Return a new BigRational with the negative value of this. |
BigRational |
pow(int exponent)
Calculate a BigRational's integer power and return a new BigRational. |
BigRational |
remainder(BigRational that)
Calculate the remainder of two BigRationals and return a new BigRational. |
BigRational |
remainder(long that)
Calculate the remainder of a BigRational and a long fix number integer and return a new BigRational. |
BigRational |
round()
Round by default mode. |
BigRational |
round(int roundMode)
Round. |
int |
signum()
Signum, -1, 0, or 1. |
BigRational |
subtract(BigRational that)
Subtract a BigRational from another (this) and return a new BigRational. |
BigRational |
subtract(long that)
Subtract a long fix number integer from this and return a new BigRational. |
java.lang.String |
toString()
BigRational string representation, format "[-]d[/q]", default radix. |
java.lang.String |
toString(int radix)
BigRational string representation, format "[-]d[/q]". |
java.lang.String |
toStringDot(int precision)
Dot-format "[-]i.f" string representation, with a precision, default radix Precision may be negative. |
java.lang.String |
toStringDot(int precision,
int radix)
Dot-format "[-]i.f" string representation, with a precision. |
BigRational |
truncate()
Truncate, round towards zero. |
static BigRational |
valueOf(java.math.BigInteger value)
Manifactor a BigRational from a BigInteger. |
static BigRational |
valueOf(long value)
Manifactor a BigRational from a long fix number integer. |
| Methods inherited from class java.lang.Number |
|---|
byteValue, shortValue |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final int DEFAULT_RADIX
public static final BigRational ZERO
public static final BigRational ONE
public static final BigRational MINUS_ONE
public static final int ROUND_UP
public static final int ROUND_DOWN
public static final int ROUND_CEILING
public static final int ROUND_FLOOR
public static final int ROUND_HALF_UP
public static final int ROUND_HALF_DOWN
public static final int ROUND_HALF_EVEN
public static final int ROUND_UNNECESSARY
public static final int ROUND_HALF_CEILING
public static final int ROUND_HALF_FLOOR
public static final int ROUND_HALF_ODD
public static final int DEFAULT_ROUND_MODE
| Constructor Detail |
|---|
public BigRational(java.math.BigInteger n,
java.math.BigInteger q)
public BigRational(java.math.BigInteger n)
public BigRational(long n,
long q)
public BigRational(long n)
public BigRational(java.lang.String s,
int radix)
public BigRational(java.lang.String s)
public BigRational(java.math.BigInteger unscaledValue,
int scale,
int radix)
public BigRational(java.math.BigInteger unscaledValue,
int scale)
public BigRational(long unscaledValue,
int scale,
int radix)
| Method Detail |
|---|
public java.lang.String toString(int radix)
public java.lang.String toString()
toString in class java.lang.Object
public java.lang.String toStringDot(int precision,
int radix)
public java.lang.String toStringDot(int precision)
public java.math.BigInteger getNumerator()
public java.math.BigInteger getDenominator()
public BigRational add(BigRational that)
public BigRational add(long that)
public BigRational subtract(BigRational that)
public BigRational subtract(long that)
public BigRational multiply(BigRational that)
public BigRational multiply(long that)
public BigRational divide(BigRational that)
public BigRational divide(long that)
public BigRational pow(int exponent)
public BigRational remainder(BigRational that)
public BigRational remainder(long that)
public BigRational mod(BigRational that)
public BigRational mod(long that)
public int signum()
public BigRational abs()
public BigRational negate()
public BigRational invert()
public BigRational min(BigRational that)
public BigRational min(long that)
public BigRational max(BigRational that)
public BigRational max(long that)
public boolean equals(java.lang.Object object)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic int compareTo(BigRational that)
public int compareTo(java.math.BigInteger that)
public int compareTo(long that)
public int compareTo(java.lang.Object object)
compareTo in interface java.lang.Comparablepublic java.math.BigInteger bigIntegerValue()
public java.math.BigDecimal bigDecimalValue(int precision)
public long longValue()
longValue in class java.lang.Numberpublic int intValue()
intValue in class java.lang.Numberpublic float floatValue()
floatValue in class java.lang.Numberpublic double doubleValue()
doubleValue in class java.lang.Numberpublic static BigRational valueOf(java.math.BigInteger value)
public static BigRational valueOf(long value)
public BigRational round(int roundMode)
public BigRational round()
public BigRational floor()
public BigRational ceil()
public BigRational truncate()
public BigRational integerPart()
public BigRational fractionalPart()
public BigRational[] integerAndFractionalPart()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||