@Immutable public final class BigRational extends Number implements Comparable<BigRational>
Modifier and Type | Method and Description |
---|---|
BigRational |
abs()
Returns the absolute value of this number.
|
BigRational |
add(BigRational other)
Adds an other big rational.
|
BigRational |
add(long integer)
Adds an integer.
|
int |
compareTo(BigRational other) |
BigRational |
divide(BigRational other)
Divides by an other big rational.
|
BigRational |
divide(long integer)
Divides by an integer.
|
double |
doubleValue() |
boolean |
equals(Object object) |
float |
floatValue() |
BigInteger |
getDenominator()
Gets the denominator.
|
BigInteger |
getNumerator()
Gets the numerator.
|
int |
hashCode() |
int |
intValue() |
long |
longValue() |
BigRational |
multiply(BigRational other)
Multiplies by an other big rational.
|
BigRational |
multiply(long integer)
Multiplies by an integer.
|
BigRational |
negate()
Negates this number.
|
BigRational |
reciprocal()
Returns the reciprocal value of this number.
|
int |
signum()
Returns the signum function of this number.
|
BigRational |
subtract(BigRational other)
Subtracts an other big rational.
|
BigRational |
subtract(long integer)
Subtracts an integer.
|
String |
toString() |
static BigRational |
valueOf(BigInteger numerator,
BigInteger denominator)
Returns a big rational number from big integers.
|
static BigRational |
valueOf(long numerator,
long denominator)
Returns a big rational number from long values.
|
static BigRational |
valueOf(Rational rational)
Returns a big rational number from the value of a rational number.
|
static BigRational |
valueOf(String string)
Returns a big rational number from the value of a string.
|
@Nonnull @CheckReturnValue public static BigRational valueOf(@Nonnull Rational rational)
rational
- A rational number.@Nonnull @CheckReturnValue public static BigRational valueOf(@Nonnull String string)
string
- The string.@Nonnull @CheckReturnValue public static BigRational valueOf(@Nonnull BigInteger numerator, @Nonnull BigInteger denominator)
numerator
- The numerator.denominator
- The denominator.@Nonnull @CheckReturnValue public static BigRational valueOf(long numerator, long denominator)
numerator
- The numerator.denominator
- The denominator.@Nonnull @CheckReturnValue public BigRational abs()
@Nonnull @CheckReturnValue public BigRational add(@Nonnull BigRational other)
other
- The other big rational.@Nonnull @CheckReturnValue public BigRational add(long integer)
integer
- The (long) integer.public int compareTo(BigRational other)
compareTo
in interface Comparable<BigRational>
@Nonnull @CheckReturnValue public BigRational divide(@Nonnull BigRational other)
other
- The other rational.@Nonnull @CheckReturnValue public BigRational divide(long integer)
integer
- The (long) integer.public double doubleValue()
doubleValue
in class Number
public boolean equals(Object object)
equals
in class Object
public float floatValue()
floatValue
in class Number
@Nonnull @CheckReturnValue public BigInteger getDenominator()
@Nonnull @CheckReturnValue public BigInteger getNumerator()
public int hashCode()
hashCode
in class Object
public int intValue()
intValue
in class Number
public long longValue()
longValue
in class Number
@Nonnull @CheckReturnValue public BigRational multiply(@Nonnull BigRational other)
other
- The other rational.@Nonnull @CheckReturnValue public BigRational multiply(long integer)
integer
- The (long) integer.@Nonnull @CheckReturnValue public BigRational negate()
@Nonnull @CheckReturnValue public BigRational reciprocal()
@CheckReturnValue public int signum()
@Nonnull @CheckReturnValue public BigRational subtract(@Nonnull BigRational other)
other
- The other big rational.@Nonnull @CheckReturnValue public BigRational subtract(long integer)
integer
- The (long) integer.public String toString()
toString
in class Object
Copyright © 2003-2019 Serge Brisson. All Rights Reserved.