|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.znerd.math.NumberCentral
A static factory that produces RealNumber
objects.
Method Summary | |
static void |
checkDivideByZero(RealNumber n)
Checks if dividing by the specified number would result in a division by zero. |
static RationalNumber |
createFraction(IntegerNumber numerator,
IntegerNumber denominator)
Returns a fraction with the given numerator and denominator. |
static RationalNumber |
createFraction(int numerator,
int denominator)
Returns a fraction with the given numerator and denominator, both being an int . |
static IntegerNumber |
createInteger(byte[] bytes)
Returns an integer number from a byte array in two's complement notation. |
static IntegerNumber |
createRandomInteger(int numBytes)
Returns an IntegerNumber with a random value. |
static String |
getVersion()
Returns the current version of JUMP. |
static RealNumber |
pow(RealNumber base,
RealNumber exponent)
Computes the power of the given base and exponent. |
static RationalNumber |
valueOf(BigDecimal n)
Converts a BigDecimal to a RationalNumber . |
static IntegerNumber |
valueOf(BigInteger n)
Converts a BigInteger to an IntegerNumber . |
static IntegerNumber |
valueOf(byte n)
Converts a byte to an IntegerNumber . |
static RationalNumber |
valueOf(double n)
Converts a double to a RationalNumber . |
static RationalNumber |
valueOf(float n)
Converts a float to a RationalNumber . |
static IntegerNumber |
valueOf(int n)
Converts an int to an IntegerNumber . |
static IntegerNumber |
valueOf(long n)
Converts a long to an IntegerNumber . |
static IntegerNumber |
valueOf(short n)
Converts a short to an IntegerNumber . |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Method Detail |
public static String getVersion()
"0.5-dev"
,
never null
.public static RealNumber pow(RealNumber base, RealNumber exponent) throws IllegalArgumentException, ArithmeticException
base
- the base for the power, not null
.exponent
- the exponent for the power, not null
.null
.base == null || exponent == null
.public static RationalNumber createFraction(int numerator, int denominator) throws ArithmeticException
int
.numerator
- the numerator for the fraction.denominator
- the denominator for the fraction, not 0.null
.denominator == 0.
public static RationalNumber createFraction(IntegerNumber numerator, IntegerNumber denominator) throws ArithmeticException, IllegalArgumentException
numerator
- the numerator for the fraction, not null
.denominator
- the denominator for the fraction, not null
.null
.numerator == null || denominator == null
.denominator.equals(SmallIntegerNumber.ZERO
)
.public static IntegerNumber createInteger(byte[] bytes) throws IllegalArgumentException
bytes
- the two's complement byte array, not null
.null
.bytes == null
.public static RationalNumber valueOf(double n) throws IllegalArgumentException
double
to a RationalNumber
.n
- the value to be converted, not an infinite number, nor NaN.null
.Double.isInfinite(n) || Double.isNaN(n)
public static RationalNumber valueOf(float n) throws IllegalArgumentException
float
to a RationalNumber
.n
- the value to be converted.null
.Float.isInfinite(n) || Float.isNaN(n)
public static IntegerNumber valueOf(long n)
long
to an IntegerNumber
.n
- the value to be converted.null
.public static IntegerNumber valueOf(int n)
int
to an IntegerNumber
.n
- the value to be converted.null
.public static IntegerNumber valueOf(short n)
short
to an IntegerNumber
.n
- the value to be converted.null
.public static IntegerNumber valueOf(byte n)
byte
to an IntegerNumber
.n
- the value to be converted.null
.public static IntegerNumber valueOf(BigInteger n) throws IllegalArgumentException
BigInteger
to an IntegerNumber
.n
- the value to be converted, not null
.null
.n == null
.public static RationalNumber valueOf(BigDecimal n) throws IllegalArgumentException
BigDecimal
to a RationalNumber
.n
- the value to be converted, not null
.null
.n == null
.public static IntegerNumber createRandomInteger(int numBytes) throws IllegalArgumentException
IntegerNumber
with a random value. The maximum
number of bytes for the integer number must be specified.numBytes
- the maximum number of bytes for the constructed number, at least 1.null
.numBytes < 1
.public static void checkDivideByZero(RealNumber n) throws IllegalArgumentException, ArithmeticException
ArithmeticException
is thrown.n
- the number to compare with zero, not null
.n == null
.n.getSign
() == 0
.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |