public final class Rational extends Object implements FieldElement<Rational>
| Modifier and Type | Method and Description |
|---|---|
double |
abs()
Compute and return the absolute value of this element.
|
Rational |
additiveInverse()
Return the element of this field that, when added to this element, produces the additive identity.
|
int |
compareTo(Rational other) |
Rational |
conjugate()
Compute and return the conjugate of this element.
|
Rational |
dividedBy(Rational value)
Divide this element by the given element and return the result.
|
boolean |
equals(Object o) |
static Rational |
from(int p) |
static Rational |
from(int p,
int q) |
int |
hashCode() |
Rational |
minus(Rational other)
Subtract the given element from this element.
|
Rational |
plus(Rational other)
Add this element to the given element.
|
Rational |
sqrt()
The square root operation applied to this element.
|
Rational |
times(Rational other)
Multiply this element by the given element.
|
String |
toString() |
public static Rational from(int p, int q)
public static Rational from(int p)
public Rational plus(Rational other)
FieldElementplus in interface FieldElement<Rational>other - the element to add to this element.public Rational minus(Rational other)
FieldElementminus in interface FieldElement<Rational>other - the element to subtract from this element.public Rational times(Rational other)
FieldElementtimes in interface FieldElement<Rational>other - the element to multiply this element by.public Rational sqrt()
FieldElementsqrt in interface FieldElement<Rational>public Rational conjugate()
FieldElementconjugate in interface FieldElement<Rational>public Rational additiveInverse()
FieldElementadditiveInverse in interface FieldElement<Rational>public double abs()
FieldElementabs in interface FieldElement<Rational>public Rational dividedBy(Rational value)
FieldElementdividedBy in interface FieldElement<Rational>value - the divisor.public int compareTo(@NonNull
Rational other)
compareTo in interface Comparable<Rational>