public class Rational extends Object
n
) and a denominator
(d
). Note that the denominator is considered to hold the bit pattern
of an unsigned integer, thus if d < 0
its actual
value is (0x100000000L + d)
.Modifier and Type | Field and Description |
---|---|
int |
d
Denominator, with valid values in the closed interval
[0, 232-1]: the value is interpreted as an unsigned integer.
|
int |
n
Numerator
|
Constructor and Description |
---|
Rational() |
Rational(int n,
int d) |
Rational(Rational other) |
Modifier and Type | Method and Description |
---|---|
double |
doubleValue() |
boolean |
equals(Object obj) |
long |
getUnsignedDenominator()
Returns the value of the denominator interpreted as an unsigned
integer value with range [0, 232-1].
|
int |
hashCode() |
String |
toString() |
public int n
public int d
public Rational()
public Rational(Rational other)
public Rational(int n, int d)