|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.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 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",
never 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.
ArithmeticException - if 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.
IllegalArgumentException - if numerator == null || denominator == null.
ArithmeticException - if the denominator is zero, i.e.
denominator.equals(SmallIntegerNumber.ZERO).
public static IntegerNumber createInteger(byte[] bytes)
throws IllegalArgumentException
bytes - the two's complement byte array, not null.
null.
IllegalArgumentException - if 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.
IllegalArgumentException - if 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.
IllegalArgumentException - if 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.
IllegalArgumentException - if n == null.
public static RationalNumber valueOf(BigDecimal n)
throws IllegalArgumentException
BigDecimal to a RationalNumber.
n - the value to be converted, not null.
null.
IllegalArgumentException - if 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.
IllegalArgumentException - if numBytes < 1.
public static void checkDivideByZero(RealNumber n)
throws IllegalArgumentException,
ArithmeticException
ArithmeticException is thrown.
n - the number to compare with zero, not null.
IllegalArgumentException - if n == null.
ArithmeticException - if n.getSign() == 0.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||