public class BasicRationalNumber extends RationalNumber
IntegerNumber
objects.Modifier and Type | Field and Description |
---|---|
static BasicRationalNumber |
MINUS_ONE_HALF
Cached instance that represents the number minus one half, -1/2.
|
static BasicRationalNumber |
ONE_HALF
Cached instance that represents the number one half, 1/2.
|
MAXIMUM_RADIX
ROUND_CEILING, ROUND_DOWN, ROUND_FLOOR, ROUND_UP
Modifier | Constructor and Description |
---|---|
protected |
BasicRationalNumber(IntegerNumber numerator,
IntegerNumber denominator)
Constructs a new
BasicRationalNumber from a numerator and
a denominator. |
Modifier and Type | Method and Description |
---|---|
static BasicRationalNumber |
createInstance(IntegerNumber numerator,
IntegerNumber denominator)
Returns an instance of a
BasicRationalNumber with the
given numerator and denominator. |
add, add, compareTo, compareToImpl, compareToImpl, compareToImpl2, divide, divide, doubleValue, getDenominator, getNumerator, invert, multiply, multiply, negate, pow, powImpl, powImpl, subtract, subtract, toBigDecimal, toBigDecimal, trunc
abs, byteValue, compareTo, compareTo, equals, fitsByte, fitsDouble, fitsFloat, fitsInt, fitsLong, fitsShort, floatValue, getSign, intValue, longValue, pow, round, shortValue, toBigInteger, toString
public static final BasicRationalNumber ONE_HALF
public static final BasicRationalNumber MINUS_ONE_HALF
protected BasicRationalNumber(IntegerNumber numerator, IntegerNumber denominator) throws java.lang.IllegalArgumentException, java.lang.ArithmeticException
BasicRationalNumber
from a numerator and
a denominator.numerator
- the numerator for the fraction.denominator
- the denominator for the fraction.java.lang.IllegalArgumentException
- if one of the following applies:
null
null
java.lang.ArithmeticException
- if the value of denominator is zero.public static BasicRationalNumber createInstance(IntegerNumber numerator, IntegerNumber denominator) throws java.lang.IllegalArgumentException, java.lang.ArithmeticException
BasicRationalNumber
with the
given numerator and denominator.numerator
- the numerator for the fraction.denominator
- the denominator for the fraction.java.lang.IllegalArgumentException
- if one of the following applies:
null
null
java.lang.ArithmeticException
- if the value of denominator
is zero.