|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.lang.Number | +--com.ibm.eou.decimal.ModelNumber
This class represents a generic floating-point number, with almost no limitation on precision or magnitude, and also includes some special values. Finite numbers are represented as a sign, a finite-length coefficient expressed as a string of digits in a given radix, and a signed integer exponent. The coefficient length is limited only by storage, and the exponent is limited only to values which can be stored by a Java 'int' type. Infinities can also have a sign, and two not-a-number (NaN) values (quiet and signaling) are also supported.
Field Summary | |
static ModelNumber |
NAN
A ModelNumber representing a (quiet) NaN. |
static ModelNumber |
NEGATIVE_INFINITY
A ModelNumber representing a negative infinity. |
static ModelNumber |
POSITIVE_INFINITY
A ModelNumber representing a positive infinity. |
static ModelNumber |
SIGNALING_NAN
A ModelNumber representing a signaling NaN. |
Method Summary | |
byte |
byteValue()
|
int |
compareTo(java.lang.Object o)
|
static ModelNumber |
createFinite(int sign,
int radix,
int[] coefficient,
int exponent)
Return a ModelNumber representing a finite number. |
static ModelNumber |
createFinite(int sign,
int radix,
java.lang.String coefficient,
int exponent)
Return a ModelNumber representing a finite number. |
double |
doubleValue()
|
boolean |
equals(java.lang.Object obj)
Return true if the supplied argument is a ModelNumber equal to this ModelNumber. |
float |
floatValue()
|
int[] |
getCoefficient()
Return the coefficient digit values. |
java.lang.String |
getCoefficientAsString()
Return the coefficient as a string of digit characters. |
int |
getExponent()
Return the exponent. |
int |
getRadix()
Return the radix in which the coefficient is expressed. |
int |
getSign()
Return the sign of the value. |
int |
hashCode()
Return a hash code generated so that two ModelNumbers which compare equal with equals will
always produce the same hash code, and ModelNumbers which
do not compare equal with equals tend
to (but will not necessarily) produce different hash codes. |
int |
intValue()
|
boolean |
isFinite()
Return true if the value is finite. |
boolean |
isInfinity()
Return true if the value is an infinity. |
boolean |
isNaN()
Return true if the value is a quiet NaN. |
boolean |
isSignalingNaN()
Return true if the value is a signaling NaN. |
boolean |
isZero()
Return true if the value is a zero. |
long |
longValue()
|
static int |
parseDigit(char digit)
|
short |
shortValue()
|
java.lang.String |
toString()
Return a string representation of the internal fields of this object. |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final ModelNumber NAN
SIGNALING_NAN
public static final ModelNumber SIGNALING_NAN
NAN
public static final ModelNumber POSITIVE_INFINITY
public static final ModelNumber NEGATIVE_INFINITY
Method Detail |
public static ModelNumber createFinite(int sign, int radix, int[] coefficient, int exponent)
sign
- the sign (0=positive, 1=negative).radix
- the radix in which the coefficient is expressed.coefficient
- the coefficient.exponent
- the signed integer exponent.
public static ModelNumber createFinite(int sign, int radix, java.lang.String coefficient, int exponent)
sign
- the sign (0=positive, 1=negative).radix
- the radix in which the coefficient is expressed.coefficient
- the coefficient.exponent
- the signed integer exponent.
public static int parseDigit(char digit)
public boolean isNaN()
public boolean isSignalingNaN()
public boolean isInfinity()
getSign()
public boolean isFinite()
getSign()
,
getRadix()
,
getCoefficient()
,
getExponent()
public boolean isZero()
public int getSign()
public int getRadix()
public int[] getCoefficient()
public java.lang.String getCoefficientAsString()
public int getExponent()
public byte byteValue()
byteValue
in class java.lang.Number
Number.byteValue()
public double doubleValue()
doubleValue
in class java.lang.Number
Number.doubleValue()
public float floatValue()
floatValue
in class java.lang.Number
Number.floatValue()
public int intValue()
intValue
in class java.lang.Number
Number.intValue()
public long longValue()
longValue
in class java.lang.Number
Number.longValue()
public short shortValue()
shortValue
in class java.lang.Number
Number.shortValue()
public java.lang.String toString()
toString
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public int hashCode()
equals
will
always produce the same hash code, and ModelNumbers which
do not compare equal with equals
tend
to (but will not necessarily) produce different hash codes.
hashCode
in class java.lang.Object
public int compareTo(java.lang.Object o)
compareTo
in interface java.lang.Comparable
Comparable.compareTo(Object)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |